2

So, I could use the crontab command, with:

23 0 * ... 

but at 23:00 my laptop can be turned off, or hibernated. In that case I want a command to be executed as soon as it will be possible. How can I do that?

1
  • 1
    have a look at anacron.
    – Archemar
    Nov 29, 2015 at 10:31

1 Answer 1

2

Use @reboot in addition to your timing (if your crond supports it):

@reboot command
23 0 * * * command

The obvious caveat is that if you boot your computer at 22:59 the command will run twice in very short order. Make sure the command can be run twice at the same time without one process stomping on the other.

3
  • It helps if laptop was turned off, but usually it is hibernated or suspended.
    – Arqwer
    Nov 30, 2015 at 12:38
  • Can you add that information to the original question, or (even better) create a separate question for detecting waking from hibernation or suspension? I suspect that's a very different can of beans...
    – l0b0
    Nov 30, 2015 at 17:58
  • I thought that there is standard mechanism, to detect, if command wasn't executed, something like just a flag --yes_execute_it_if_you_didn't, so I don't have to care about all the cases, why command wasn't executed.
    – Arqwer
    Dec 1, 2015 at 18:59

You must log in to answer this question.

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