I wrote about not using DAY OF MONTH and DAY OF WEEK simultanously in how to cron
The correct method is to use
15 14 15 05 * /tmp/run-my-job
But… I wrote this five years ago. Hmmm ! Not that correct then since it would run every year 😉
Ok, periodically I check for jobs are scheduled to run a specific date only
$ crontab -l|awk '$1!~/#/&&$3*$4'
15 14 15 05 * /tmp/run-my-job
I have 9 more days to remove this before it runs for the fifth time 🙂
Surely the “at” command would be more appropriate for scheduling a job to run just once in the future?
Indeed Colin, but one sysadmin may prefer to authorized only one type of scheduler (cron).
How about
15 14 15 05 * /tmp/run-my-job; mv /tmp/run-my-job /tmp/run-my-job-hold 2>/dev/null
it wont find it next time
/S/
good idea, or maybe
55 17 23 05 * /bin/runyourscript ; crontab -l | grep -v DELETEME-001 | crontab
🙂
so it will autodelete