Benches Uncategorized

5

Cron task to reboot computer?

apple Verified

Imported from the Apple Support Forums via the Wayback Machine 🔗

Howdy,

I've setup a simple cron task in /etc/crontab to reboot the computer every morning at 6AM but it's not working. It reads as follows:

minute hour mday month wday who command
0 6 * * 1-5 root reboot

Anyone got any ideas why it wouldn't run?

thanks
A

5 replies

Sign in or join Beachball Help to reply.

  1. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Try:


    0 6 * * 1-5 root /sbin/reboot

  2. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Usually you need to add the full path of the binary to crontabs, so in this case it would be

    0 6 * * 1-5 root /sbin/reboot

    Doug

  3. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks fellas. I'll make the change and post back tomorrow with the results!

  4. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Doug Niven1 wrote:
    Usually you need to add the full path of the binary to crontabs

    Yes, that's often the case. Also, it's possible that reboot won't work if it's not run by the root user. I know that's the case with shutdown (and the UPS shutdown script that uses shutdown). If it is, then you'll have to put it into the root user's crontab:

    <pre class="command">sudo crontab -e</pre>

    At least that's the way it is on Tiger...

    charlie

  5. 0

    Apple Support Community member

    Imported from the Apple Support Forums via the Wayback Machine 🔗

    Thanks fellas. Worked perfectly.