use cron to schedule a job only once

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 🙂

4 thoughts on “use cron to schedule a job only once

  1. Sudhir

    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/

Comments are closed.