Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Cron job to run every other Sunday 2

Status
Not open for further replies.

austin123

Technical User
Mar 21, 2003
4
GB
Hi,
Can anyone help me, we have an (e10k sol8) and I need to set up a cronjob that runs every other Sunday at 2am.
Is there any simple way to do this?
Cheers,
Austin.
 
Just read the man page (man crontab).
 
I don't think there is using crontab alone. Try using some sanity checking/logic in your script. You could do something like have a file with a 1 or a 0 in it and have the script run every sunday, if it's a "1" it runs the process and changes it to "0", if it's a "0" it doesn't run the process but changes the value to "1". Something like that should work.

HTH
Brian
 
Thanks for the replies, what I ended up doing was :-

WK=`/usr/bin/date +%U`
WKNO=`/usr/bin/expr $WK % 2`
if [ $WKNO -eq 1 ]; then
echo "No back up this week - once a fortnight only."
exit 0
fi

This seems to work fine!,
Cheers.


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top