Help need urgently....

I am new to shell scripting

I am getting file sample.txt from mainframes to my unix machine Mon-Fri every 15 minutes from 9:00AM to 6:00PM.
I need to Compare timestamp of sample.txt against system time via a Unix script kicked off by an Autosys job
My Task is to write a shell script to monitor the file for every 15 minutes.
If the file has not arrived more than 30 min i need to send email and also generate log file with start and end times.

Please help

My deadline is 3 days for this task

What have you tried so far ?
If you haven't, then try something from your side and ask specific questions/doubts instead of dumping your entire task on a forum of volunteers.

tyler_durden

I am trying to run this one in telnet

#!/bin/ksh
File1=simple.txt    # The file to check
LogFile=simple.log # The log file
DelayMax=30 # Timeout delay
Tolerance=2
# BEGIN ##############################
while true
do
    StampNow=$(date +%s)/60    # stamp in minutes
    StampFile=$(date -r "$File1" +%s)/60
    let Delay=$StampNow-$StampFile
    if [ $Delay -gt $DelayMax ]
    then
        echo "TIME STARTED = $(date +%Y-%m-%d_%H:%M:%S)" > $LogFile
	echo "TIME ENDED = $(date +%Y-%m-%d_%H:%M:%S)"  >> $LogFile
        # etc.
        exit 1
    elif [ $StampFile -eq $StampOld ]
    then
        sleep $Tolerance  # Retry a bit later
    else
        StampOld=$StampFile
        let NewDelay=$StampNow-$StampFile+15+$Tolerance # To synchronize with the updating
        sleep $NewDelay minutes
    fi
done

---------- Post updated at 02:01 PM ---------- Previous update was at 02:00 PM ----------

Below is the error log

date: bad format character - s
date: illegal option -- r
Usage: date [-u] [+format]
       date [-u] [mmddhhmm[[cc]yy]]
       date [-a [-]sss.fff]
sam.ksh[11]: Delay=/60-/60: syntax error
sam.ksh[18]: /60: syntax error
sam.ksh[23]: NewDelay=/60-/60+15+2: syntax error
usage: sleep time

---------- Post updated at 02:02 PM ---------- Previous update was at 02:01 PM ----------

To be frank i am totally new to this scripting.

Please help

This is exactly the same script and error message as in your previous post. Thread closed.