chewlf
asked on
How to setup Crontab to run the job fortnightly
To all the expert,
Anyone know how to write the crontab to run the job fortnightly? Not type of 1st and 3rd week of the month (typical example) because the accuracy is not there. What I want is the crontab able to run the job exactly two weeks once. Please advice.
Thanks,
Chewlf
Anyone know how to write the crontab to run the job fortnightly? Not type of 1st and 3rd week of the month (typical example) because the accuracy is not there. What I want is the crontab able to run the job exactly two weeks once. Please advice.
Thanks,
Chewlf
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Do you want to run the script everyday in ONE week ON and ONE week OFF mode.
My first script should work for you.
It this is not what you want, please let us know exactly what you want to do.
My first script should work for you.
It this is not what you want, please let us know exactly what you want to do.
To have a script schedule a cron job, it should:
1st - copy the crontab file to a temp file.
2nd - append the job to the temp file.
3rd - run crontab with the tempfile as its argument.
This will replace the existing crontab file.
To unschedule the cron job:
1st - sed the crontab file to remove the job.
Redirect the sed output to a temp file.
2nd - run crontab with the tempfile as its argument.
This will replace the existing crontab file.
If you need exact commands, let me know.
1st - copy the crontab file to a temp file.
2nd - append the job to the temp file.
3rd - run crontab with the tempfile as its argument.
This will replace the existing crontab file.
To unschedule the cron job:
1st - sed the crontab file to remove the job.
Redirect the sed output to a temp file.
2nd - run crontab with the tempfile as its argument.
This will replace the existing crontab file.
If you need exact commands, let me know.
ASKER
Thanks,
Chewlf