Hello All,
I want to run a script for every 5 minutes interval.So i developed a script which has to be scheduled to run for every 5 minutes. That script internally runs another script. But the problem is it is not executing properly. Can anybody throw some light on this.
Below are the code snippets for the two scripts.
the first script FirstScript.sh
LogMessage ()
################################################################################
# #
# Write message to log file. #
# #
################################################################################
{
echo "`date` - ${*}" >> $path/applicationLogFile.log
}
ps -e |grep "SecondS*"
scriptStatus=$?
if [ -f $inputfile ]
then
if [ $scriptStatus -ne 0 ]
then
LogMessage "The input file is found."
LogMessage "Initiating RVPMIG2X script"
sh $path/RVPMIG2Xdummy.sh
else
LogMessage "The script is already running.Can not initiate again"
fi
else
LogMessage "The input file is not found"
fi
My SecondScript.sh is as follows:
#! /bin/ksh
echo "Starting the dummy script."
sleep 620
echo "Ending the Script."
Though my second script sleeps for 620 seconds that means for about more than 10 mins but the inner else block is never getting invoked.
i set the cron job as
0,5,10,15,20,25,30,35,40,45,50,55 * * * * sh FirstScript.sh.
when i run the FirstScript normally it is working perfectly fine but when i put it in cron job it is not. Can anybody tell me for this erratic behaviour?
Thanks a lot in advance.
RSC1985
---------- Post updated at 02:44 AM ---------- Previous update was at 02:43 AM ----------
In the code snippet instead of RVPMIG2Xdummy.sh please treat it as SecondScript.sh