Is there a way to setup cron (or any other scheduler, like anacron) to run such that it checks immediately after I resume working on my laptop (e.g. after suspension or shutdown) whether it has executed a certain script that was scheduled while my laptop was inactive?
The reason for this is that I frequently do things like suspend my laptop or shut it down and in both cases cron obviously doesn't run. When I then return to normal operation the missed commands aren't executed.
I know there is the tool called anacron for machines that aren't running continuously, which therefore periodically checks whether scheduled scripts were run, but the problem with that is that:
- there is a time interval between checking whether scripts were run and one of the use cases for me is to change my screen color at a certain time in the evening; after starting my laptop later in the evening I'd only be willing to wait at most half a second (!) until the color change is carried out and I guess a scheduler with a time period of half a second is probably inducing a bit of unnecessary load on my system (if such rapid checks are even possible)
- for anacron the waiting period is days which rules out any tweaks with anacron :(
Running rtcwake is also not an option: It would be way too cumbersome to pad each script with more code to potentially wake the entire system just to do simple plumbing stuff like to change my screen color.