5

I have several cron jobs that are executed every minute, and I’m thinking on putting @reboot jobs. They are put and executed with root privileges.

So here’s what I want to know. Will these cron jobs run when system gets to the login screen after rebooting? Will @reboot entries run after reboot without me getting logged into root?

0

1 Answer 1

7

The cron daemon will start cron jobs scheduled with @reboot as soon as the daemon has started after system boot. It does not matter whether any user has had the time to log in on the newly rebooted system or not or whether the job belongs to the root user or any other user on the system. It is likely that such jobs will run before or as a graphical login screen appears if the system uses one. Basic daemons, like the cron daemon, are usually started before login display managers.

As an example, OpenBSD, like Ubuntu and macOS, is using the Vixie cron daemon. It executes @reboot jobs before even entering its main loop (code is here).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .