Reputation: 1037
I wanted to create a crontab file with schedule but do not want it to run. How can I achieve this?
I created a crontab file using crontab -e
, added the job. This has started running. I do not want this to run as the job should be scheduled ad hoc.
I wanted to prepare and keep and use the schedule on ad hoc.
Upvotes: 0
Views: 275
Reputation: 58
You could test for a file to be present and if it does it'll execute your task:
5 * * * * user test -f /var/lock/subsys/myfile && /home/user/backup.sh
Thus when you are ready. You just
touch /var/lock/subsys/myfile
and the script starts within the next five minutes.
But you have to make sure to remove the lock file afterwards.
Upvotes: 1
Reputation: 1545
You can comment your schedule line out with a leading #
, and remove the comment marker again when you want it to run.
http://man7.org/linux/man-pages/man5/crontab.5.html
Upvotes: 1