Link to home
Start Free TrialLog in
Avatar of enthuguy
enthuguyFlag for Australia

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
Avatar of Brandon Muller
Brandon Muller
Flag of South Africa image

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
Avatar of Kimputer
Kimputer

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of enthuguy

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?
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
cron jobs always recur.

at jobs are the run once jobs.