Will croned tasks run while iBook is asleep?

Hobo wrote on :
If I cron a task to run 3 hours from now and set my iBook to sleep after 1 hour of inactivity and then leave the thing alone will the croned task run?
ZnU replied on :

In article myusenetclient-016387.01564721122001@redacted.invalid, Hobo myusenetclient@redacted.invalid wrote:

If I cron a task to run 3 hours from now and set my iBook to sleep after 1 hour of inactivity and then leave the thing alone will the croned task run?

No. Nothing happens in sleep. The CPU isn't even powered. And so far, there's not enough integration between cron and the OS's power management for the system to automatically wake up when there's a job to run.

David Baker replied on :

in article myusenetclient-016387.01564721122001@redacted.invalid, Hobo at myusenetclient@redacted.invalid wrote on 12/21/01 2:56 AM:

If I cron a task to run 3 hours from now and set my iBook to sleep after 1 hour of inactivity and then leave the thing alone will the croned task run?

No such luck. You have to have the screen go blank (see the Energy control pane), but if the computer goes to sleep your cron jobs won't run.

M. Perry replied on :

In article myusenetclient-016387.01564721122001@redacted.invalid, Hobo myusenetclient@redacted.invalid wrote:

If I cron a task to run 3 hours from now and set my iBook to sleep after 1 hour of inactivity and then leave the thing alone will the croned task run?

Nope, nothing runs while your Mac is asleep. Think of it is more like a coma than a light sleep.

--MP

Andrew J. Brehm replied on :

ZnU znu@redacted.invalid wrote:

In article myusenetclient-016387.01564721122001@redacted.invalid, Hobo myusenetclient@redacted.invalid wrote:

If I cron a task to run 3 hours from now and set my iBook to sleep after 1 hour of inactivity and then leave the thing alone will the croned task run?

No. Nothing happens in sleep. The CPU isn't even powered. And so far, there's not enough integration between cron and the OS's power management for the system to automatically wake up when there's a job to run.

That reminds me, is there any way to wake up an OS X machine via the network?

It doesn't seem to work.

I tried calling the modem, but for some reason it won't detect the ring and wake up either.

matt neuburg replied on :

In article blackhole33-31A0C6.17011221122001@redacted.invalid, "M. Perry" blackhole33@redacted.invalid wrote:

In article myusenetclient-016387.01564721122001@redacted.invalid, Hobo myusenetclient@redacted.invalid wrote:

If I cron a task to run 3 hours from now and set my iBook to sleep after 1 hour of inactivity and then leave the thing alone will the croned task run?

Nope, nothing runs while your Mac is asleep

It's even worse than that: after you Mac wakes up, it won't say, "Oooops, I missed a task while I was asleep, I'd better do it now." A task missed is missed forever. This is why there's MacJanitor; otherwise my Mac would never get to do any periodic cleanup at all. m.

Morten Reippuert Knudsen replied on :

Hobo myusenetclient@redacted.invalid wrote:

If I cron a task to run 3 hours from now and set my iBook to sleep after 1 hour of inactivity and then leave the thing alone will the croned task run?

just edit the system croontab to run at a time where you know the mac is running - or even better: install "anacron", it will chek if your croonjobs are overdue and run them automaticly.

Charles Martin replied on :

In article 1f4sq6x.1s5vk4t1stast7N%andrew@redacted.invalid, andrew@redacted.invalid (Andrew J. Brehm) wrote:

ZnU znu@redacted.invalid wrote:

In article myusenetclient-016387.01564721122001@redacted.invalid, Hobo myusenetclient@redacted.invalid wrote:

If I cron a task to run 3 hours from now and set my iBook to sleep after 1 hour of inactivity and then leave the thing alone will the croned task run?

No. Nothing happens in sleep. The CPU isn't even powered. And so far, there's not enough integration between cron and the OS's power management for the system to automatically wake up when there's a job to run.

That reminds me, is there any way to wake up an OS X machine via the network?

It doesn't seem to work.

I tried calling the modem, but for some reason it won't detect the ring and wake up either.

These are preferences that you can set in the Energy Saver control panel, "wake up on network activity."

Laurent Daudelin replied on :

In message myusenetclient-016387.01564721122001@redacted.invalid, Hobo myusenetclient@redacted.invalid wrote:

If I cron a task to run 3 hours from now and set my iBook to sleep after 1 hour of inactivity and then leave the thing alone will the croned task run?

I don't think so. Nothing is running when your computer is asleep, not even the processor, I would think. There is power used to maintain the content of the RAM, but that's pretty much it.

-Laurent.

Simon Slavin replied on :

In article myusenetclient-016387.01564721122001@redacted.invalid, Hobo myusenetclient@redacted.invalid wrote:

If I cron a task to run 3 hours from now and set my iBook to sleep after 1 hour of inactivity and then leave the thing alone will the croned task run?

No. This is a bug in Unix: it wasn't really designed with computers that can sleep in mind. The fix would be to change the way that 'cron' works so that it could tell it had skipped past the trigger-time for something while asleep and run it soon after it woke up.

This is not just a problem with Darwin, but an underlying problem with all implementations of the Unix 'cron' utility. Various approaches have been taken to fixing it but I don't know if any of them have been widely distributed.

Simon.

Simon Slavin replied on :

In article 1f4sq6x.1s5vk4t1stast7N%andrew@redacted.invalid, andrew@redacted.invalid (Andrew J. Brehm) wrote:

That reminds me, is there any way to wake up an OS X machine via the network?

No. Because to analyse what was happening on the network the machine would have to be awake.

Simon.

ZnU replied on :

In article B84D691596684215@redacted.invalid, slavins@redacted.invalid@redacted.invalid (Simon Slavin) wrote:

In article 1f4sq6x.1s5vk4t1stast7N%andrew@redacted.invalid, andrew@redacted.invalid (Andrew J. Brehm) wrote:

That reminds me, is there any way to wake up an OS X machine via the network?

No. Because to analyse what was happening on the network the machine would have to be awake.

Not if the networking hardware supports wake-on-LAN, which it does in recent Macs. But OS X's support for this seems somewhat incomplete.

Jeremy replied on :

Simon Slavin <slavins@redacted.invalid@redacted.invalid> wrote:

No. This is a bug in Unix: it wasn't really designed with computers that can sleep in mind. The fix would be to change the way that 'cron' works so that it could tell it had skipped past the trigger-time for something while asleep and run it soon after it woke up.

This is not just a problem with Darwin, but an underlying problem with all implementations of the Unix 'cron' utility. Various approaches have been taken to fixing it but I don't know if any of them have been widely distributed.

Well, a real solution isn't quite as simple as just running skipped jobs after waking up. What if, for example, I have something set up to run every hour, and then put the machine to sleep all night? Should cron run it once for each skipped hour, or just once, or do I not care about the skipped jobs and not want them to "catch up" at all?

And what if the machine was asleep, and skipped a bunch of potentially resource-intensive jobs that were "spread out" over the night? Should they all run at once? How is cron to know how to space them out, or whether to do so at all?

So you'd really have to change the crontab syntax in order to "fix" this.

Simon Slavin replied on :

In article 1009272088.207705@redacted.invalid, Jeremy jeremy@redacted.invalid wrote:

Well, a real solution isn't quite as simple as just running skipped jobs after waking up. What if, for example, I have something set up to run every hour, and then put the machine to sleep all night? Should cron run it once for each skipped hour, or just once, or do I not care about the skipped jobs and not want them to "catch up" at all?

Good point. You're right: to implement it correctly you'd have to have a way to saying how you wanted those jobs handled.

Simon.