crontab

i wrote a shell script and put it in a crontab.

but the script is not working.

please help

thanks in advance

check whether you script is in executable mode or not

else run this

chmod +x <file-name>

yes is there

check whether you have included

(assuming ksh )

# !/usr/bin/ksh

in the start of the script

and redirect the script errors to error log file, you can get some clues from that

no use not working

paste your "crontab -l" o/p here

#* * * * * /bin/csh /opt/terascan/bin/daily_updates > /home/teradm/cr-test.txt
#* * * * * /bin/csh /home/teradm/vr_peek.csh

#38 07 * * * /bin/csh /opt/terascan/wds_register > /home/teradm/reg
33 05 * * * /bin/csh /home/teradm/vr_peek.csh

06 08 * * * /bin/csh /home/teradm/test.csh

01 08 * * * /opt/terascan/bin/lspass >> /home/teradm/pas

So this is your cron job

33 05 * * * /bin/csh /home/teradm/vr_peek.csh
06 08 * * * /bin/csh /home/teradm/test.csh
01 08 * * * /opt/terascan/bin/lspass >> /home/teradm/pas

Try this and see whether it is running or not, if running then whats the error and it is not running then some prob in cron setup

33 05 * * * /bin/csh /home/teradm/vr_peek.csh >/$HOME/cron_log1.log 2>&1
06 08 * * * /bin/csh /home/teradm/test.csh >/$HOME/cron_log2.log 2>&1

dear csaha

my script is like this

#vr_peek.csh

set yer=`date +%Y`
set dat=`date +%d`
set montmp=`date +%b`

#peekauto > vrtmp \
peekauto > vrtmp \
num_days='1' \

cat vrtmp | tee -a schedule
#rm -f vrtmp
set pass=`cal $mon $yer | sed '/^$/d' | tail -1 | awk '{printf $NF}'`
#echo $pass
set vrfir=`expr $pass - 1`
#echo $vrfir
#echo $dat
#echo $pass

if ($dat == $vrfir) then
mv schedule $montmp$yer
#else
#mv schedule $montmp$yer
endif
exit 0

output of crontab log is like this.

peekauto: Command not found

but this command is there in my /opt/terascan/bin dir.

if i give from command prompt peekauto is working.

when i put in script it is not working.

... and you've already checked the FAQs, right?

I suggest changing the default SHELL that cron is using, /bin/sh (I think?), to the SHELL your script is written in. You will have to dig, a little, i.e. man cron. But chaning the default SHELL variable that cron uses should do the job!

Good luck!
:slight_smile: