enthuguy
asked on
How to set crontab to execute only once
Hi experts,
Have a schedule job which I would like to execute at 2am with crontab expression (command).
Question is How can I write it to execute only once please?
I know it defeats the purpose, but how to come up with the cmd pls
Eg. If I schedule it for tomorrow 2am, it should execute at 2 and it should never re-execute
Thanks in advance
Have a schedule job which I would like to execute at 2am with crontab expression (command).
Question is How can I write it to execute only once please?
I know it defeats the purpose, but how to come up with the cmd pls
Eg. If I schedule it for tomorrow 2am, it should execute at 2 and it should never re-execute
Thanks in advance
I would suggest setting it up as you would a recurring cronjob with your day/time etc. Then after it is complete you can just go and move your script out of your crontab or run crontab -r to remove all cron jobs. You can verify your cron jobs that are scheduled with crontab -1 command. Hope this helps.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thx
But trying to avoid manual or dependent script
Plus we have other jobs runs as well in different timings. Is there a crontab syntax which execute only once pls?
But trying to avoid manual or dependent script
Plus we have other jobs runs as well in different timings. Is there a crontab syntax which execute only once pls?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
cron jobs always recur.
at jobs are the run once jobs.
at jobs are the run once jobs.