|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Scheduling cron
The below syntax for the crontab entry runs every Sunday at Midnight. Correct?
* 0 * * 0 Now how would it be if I wanted it to run every other Sunday at Midnight??? Thanks Tracy ![]() |
|
#2
|
|||
|
|||
|
There isn't really a built in way of doing this. Your best bet is to continue to have cron run the job every Sunday but to determine if this is a "run" Sunday or not from within the shell script that runs whatever it is you need to run. A simple way would be to touch a particular file when the run is done. When the shell script is started again it can look at the file and figure out how old it is. If it is two weeks old then it is time to run again. Otherwise just exit.
Cron is useful for simple scheduling but falls down for anything even slightly more complicated like you have.
__________________
Need Java help? Want to help people who do? Sit down with a cup of Java at the hotjoe forums. |
|
#3
|
|||
|
|||
|
Beware - the * in the 1st column means EVERY minute, so using it will mean the command will run 60 times, from 00:00 to 00:59.
The flag file is a good idea - if you are just using this command from cron you coudl not bother about how old it is, just as a 'did I run last week?' flag. If you use the command yoursefl, your could put a wrapper script around it and run that from cron. |
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Scheduling cron |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|