crontab scheduling
|
Original Message
|
Name: pjb
Date: January 3, 2002 at 12:00:50 Pacific
Subject: crontab scheduling
|
Comment: Is it possible to set crontab to schedule a job to run on the second Monday of the month
Report Offensive Message For Removal
|
|
Response Number 1
|
Name: ramzi
Date: January 3, 2002 at 18:03:50 Pacific
Subject: crontab scheduling
|
Reply: (edit)hi pjb, i dont think crontab can do that. however,i have a shell script to generate a crontab file doing exactly what you intended here. this shell script is itself scheduled in the crontab. it shall run every first day of every month. it will get the date of the second monday of that month. then it will rewrite the crontab file which schedules the command i want to run on every second monday. hope this help. ramzi kuala lumpur, malaysia
Report Offensive Follow Up For Removal
|
|
Response Number 2
|
Name: James Boothe
Date: January 4, 2002 at 08:26:01 Pacific
Subject: crontab scheduling |
Reply: (edit)Here is an approach that does not involve rewriting the crontab file. Schedule your job for EVERY Monday. Make the job check if it is the second Monday, and exit if not. The second Monday will be in calendar date range 8-14. In the code below, the check to see if it is Monday is redundant since cron will run it only on Mondays. As coded, it could be scheduled for daily cron execution, and it would process only on second Mondays. dow=`date +%a` day=`date +%d` if [ $dow != Mon -o \ $day -lt 8 -o \ $day -gt 14 ] then echo 'Will not run - not 2nd Monday' exit fi echo 'This is 2nd Monday. Continuing ...'
Report Offensive Follow Up For Removal
|
Use following form to reply to current message: