I need to modify this script.
Right now it ONE checks log files for how the job ended, I need it to check a range of logfiles 15 to 20 and I need it to take the logfiles that are created AFTER 10 am. today.
I know the way the log files that I need to check looks
“NAME”_”jobreg-not importent”_”SND”_”DATE-YYYYMMDD”_”TIME-HHMMSS”.log
I know the “NAME”, “jobreg” and “SND” of alle the logfiles(they are the same every day)
Here are some examples of the logfiles that I want to look at notice that the only time that differs in the files are the date.
BLPREP_10N01022001_SND_”date after today at 10 am.”
ARPHPPRCVRY_BYREQ_SND_”date after today at 10 am.”
ARPHPRSPL_ARPAY_DDB_SND_”date after today at 10 am.”
ARPHPRCHK_ARPAY_DDB_SND_”date after today at 10 am.”
ARPB01DAYREP_ENDDAY_SND_”date after today at 10 am.”
more larstjeklog.sh
#!/bin/ksh
found=``
status=``
echo $status
# Check number of parameters
if [ $# != 1 ]
then
echo SYNTAX : Insert logfile as parameter
echo EXAMPLE : tjeklog.sh BLPREP_10N01022001_SND_20010204_070223.log
return 1
fi
print ""
while [ "$found" = "" ]
do
logfile=`ls /usr/users/operator/var/snd/log/$1`
status=`tail -10 ${logfile} | grep "Operational Job ended" `
#status=`tail -1 ${logfile} | grep "0" `
echo $status
if [ "$status" != "" ]
then
found=1
echo "$status" |mailx -s Status test@hotmail.com
else
echo "Jobs still running"
fi
sleep 100
done
exit;
Right now it ONE checks log files for how the job ended, I need it to check a range of logfiles 15 to 20 and I need it to take the logfiles that are created AFTER 10 am. today.
I know the way the log files that I need to check looks
“NAME”_”jobreg-not importent”_”SND”_”DATE-YYYYMMDD”_”TIME-HHMMSS”.log
I know the “NAME”, “jobreg” and “SND” of alle the logfiles(they are the same every day)
Here are some examples of the logfiles that I want to look at notice that the only time that differs in the files are the date.
BLPREP_10N01022001_SND_”date after today at 10 am.”
ARPHPPRCVRY_BYREQ_SND_”date after today at 10 am.”
ARPHPRSPL_ARPAY_DDB_SND_”date after today at 10 am.”
ARPHPRCHK_ARPAY_DDB_SND_”date after today at 10 am.”
ARPB01DAYREP_ENDDAY_SND_”date after today at 10 am.”
more larstjeklog.sh
#!/bin/ksh
found=``
status=``
echo $status
# Check number of parameters
if [ $# != 1 ]
then
echo SYNTAX : Insert logfile as parameter
echo EXAMPLE : tjeklog.sh BLPREP_10N01022001_SND_20010204_070223.log
return 1
fi
print ""
while [ "$found" = "" ]
do
logfile=`ls /usr/users/operator/var/snd/log/$1`
status=`tail -10 ${logfile} | grep "Operational Job ended" `
#status=`tail -1 ${logfile} | grep "0" `
echo $status
if [ "$status" != "" ]
then
found=1
echo "$status" |mailx -s Status test@hotmail.com
else
echo "Jobs still running"
fi
sleep 100
done
exit;