The UNIX and Linux Forums  
Hello and Welcome from to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 01-05-2009
ace@123 ace@123 is offline
Registered User
  
 

Join Date: Jan 2009
Posts: 2
unable to schedule in cron

the follwing script is running fine , when run from the ksh shell...it runs properly i.e. waits for a file "test.flag" and sends mail accordingly.


But when I schedule it in the crontab ...it does not run at the specified time (it never runs).
I am using ksh

####shell script starts
count=1
while true; do
if test -f test.flag
then
mailx -s "File Found" s.ba@dsc.com s.ba@hcil.in </man/prd2/bat/tmp/found.txt
exit 0
fi
let count="$count + 1"
#####count=$(( $count + 1 ))
sleep 2
####wait (2)
if [ $count -gt 300 ]
then
mailx -s "File not Found" s.ba@dsc.com s.ba@hcil.in </man/prd2/bat/tmp/not_found.txt
exit 0
fi
done

####shell script ends

###ran crontab -l
20 11 * * * /sa/p/brd/tmp/mailer.sh

##### ran uname -X
System = SunOS
Node = ritba
Release = 5.8
KernelID = Generic_108528-24
Machine = sun4u
BusType = <unknown>
Serial = <unknown>
Users = <unknown>
OEM# = 0
Origin# = 1
NumCPU = 2


Please suggest, (the path of .txt files is correct)

Last edited by ace@123; 01-06-2009 at 01:13 AM.. Reason: added info