Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

carlsson

macrumors 6502a
Original poster
Jul 18, 2001
600
521
I want my old server to restart itself every night. So I edited the Crontab, added this:

40 3 * * * shutdown -r now

Still, it won't restart.

What am I doing wrong? Is there a simpler way to make the Mac restart every night?
 
Hmmm, I changed the command to
/sbin/shutdown -r now

...and now it works. It was not shut down gracefully though. :-|
 
Instead of the shutdown command, try this:

Code:
osascript -e 'tell app "System Events" to restart'

It works from the command line, but haven't tried it from a cron job.
 
Thanks Scooby.

However, the shutdown -r function works now with crontab and it all seems okey. I just want to confirm that the reboot is a graceful one. Do you know?
 
Thanks Scooby.

However, the shutdown -r function works now with crontab and it all seems okey. I just want to confirm that the reboot is a graceful one. Do you know?

It is clean as far as the OS is considered. However I think the method I told you about will more safely shutdown a logged in session. For example, the shutdown -r will reboot even if you have a document opened an not saved.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.