I wrote a cron job to do backups over wifi to another computer. It works perfectly when I'm using the machine, but I prefer to schedule it at night when I'm not using it. The first step is to ping the backup server once and fail the whole script if that step fails.

It consistently fails. :(

I've got Energy Saver set to never sleep (when plugged in).

Does OS X always put the wifi to sleep after a certain time or something? Does it not wake it up for cron jobs? Or maybe it does, but I just need to wait for it to connect?

Update: @bmike asked about my pmset -g log output. I use terminal-notifier to send a notification.

2015-05-13 16:05:23 -0700 Assertions            PID 56(powerd) TimedOut InternalPreventDisplaySleep "com.apple.powermanagement.delayDisplayOff" 00:09:22  id:0x100000032b [System: DeclUser IntPrevDisp kDisp]
2015-05-14 00:00:01 -0700 Assertions            PID 552(NotificationCen) Created DisplayWake "com.apple.notificationcenter.sleeping-note" 00:00:00  id:0xe00000bc1 [System: DeclUser DispWake kDisp]
2015-05-14 00:00:11 -0700 Assertions            PID 552(NotificationCen) Released DisplayWake "com.apple.notificationcenter.sleeping-note" 00:00:10  id:0xe00000bc1 [System: DeclUser kDisp]
  • Hmm - you might have other issues if the machine is sleeping. Does pmset -g log or pmset -g assertionslog show anything of interest?
    – bmike
    Commented May 14, 2015 at 16:48
  • @bmike: Added logs for you.
    – nfirvine
    Commented May 14, 2015 at 22:50

1 Answer 1


I have solved this indirectly in the past several times like this:

One Mac (the one that is supposed to never sleep) has a Energy Saver schedule to wake up or power on every morning at 2:55 AM. It's set to not sleep, but it also has launchd jobs (cron is fine too if you want to maintain that older scheduling method) that SSH in to the client Macs.

The client Macs are set to allow wake for remote access, allow Power Nap (if supported) and set to allow SSH.

We have several AirPort and AppleTV that will proxy the ssh requests and send a wake packet to the client macs if they happen to be sleeping.

The clients then can have their cron tasks scheduled for when they wake.

If you spend too much time making this work, you can instead put a backup hook into the periodic tasks or convert them to launchd and have them run opportunistically even when the ideal scheduled time has passed.

  • What do you mean by "you can instead put a backup hook into the periodic tasks"?
    – nfirvine
    Commented May 14, 2015 at 22:51
  • man periodic and ls /private/etc/periodic should get you started.
    – bmike
    Commented May 15, 2015 at 14:45

You must log in to answer this question.

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