Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

A cron job that will never execute

Tags:

unix

cron

Is there any way to create a cron expression for not running the job at all?

I though of using this expression :

0 0 0 1 1 ? 3099

...which will practically do the job as it will run on year 3099, but is there a cleaner way to do it?

like image 713
Madhu CM Avatar asked Nov 30 '11 10:11

Madhu CM


People also ask

What does 0 * * * * mean in crontab?

0 * * * * -this means the cron will run always when the minutes are 0 (so hourly) 0 1 * * * - this means the cron will run always at 1 o'clock. * 1 * * * - this means the cron will run each minute when the hour is 1.

Can a cron job fail?

Cron tasks may fail due to resource depletion. These tasks may run out of disk space or a lack of available space may cause an operating system to be unable to start new threads. There are various ways to check how much disk space is used and what it's used by.

Why does my cron job not run?

Crontab might fail for a variety of reasons: The first reason is that your cron daemon might not be working for any reason, resulting in your crontab failing. There also exists a possibility that your system's environment variables are not settled correctly.

How do you stop a cron expression?

Stop a cron job You can stop a single cron job by removing its line from the crontab file. To do that, run the crontab -e command and then delete the line for the specific task. Alternatively, you can stop the cron job by commenting it out in the crontab file.


1 Answers

If you're still looking for something robust even in the far future, try https://stackoverflow.com/a/13938099/1601531, where I suggest the use of February 31st in crontab entries which are never intended to execute.

0 0 5 31 2 ? 
like image 63
Eric Tjossem Avatar answered Oct 04 '22 14:10

Eric Tjossem