GalacticRaph
GalacticRaph

Reputation: 962

Do Cronjobs remember last runtime after reboot?

Consider the following scenario:

Let's say I have a cronjob running every 3 hours (0 */3 * * *).

The job just ran 2 minutes ago.

If I were to reboot my computer right after it runs, will the cronjob remember that it just ran ~2 minutes ago, or will it run directly after it boots?

Upvotes: 0

Views: 376

Answers (1)

Keith Thompson
Keith Thompson

Reputation: 263387

Neither.

It doesn't need to remember that it just ran. The job runs at 0:00 03:00, 06:00, etc. If the system isn't up at the scheduled time, the job doesn't run.

If the job ran at 03:00 and you reboot at 03:02, the job won't run again until 06:00.

(If you want jobs to run if they couldn't run before because the system was down, see anacron.)

Upvotes: 1

Related Questions