Posts Tagged ‘at’
Sleep does cron
It’s been a while since I said what was happening with the Sleep project, if I ever did, so here’s a catch-up.
It’s an LCFG component which will run on DICE desktop machines. The idea is to save money by saving electricity. The component will decide whether or not it’s safe to put the machine into a sleep state, and if it is, send the machine to seep.
The component will attempt to make sure that the machine doesn’t miss any cron jobs, so before sleeping the machine it’ll calculate when the machine should wake for the next cron job, and set the machine’s wake time appropriately.
At the moment the sleep component successfully handles the cron aspect of the job, sets the wake time, and puts the machine to sleep. It doesn’t yet judge whether or when putting the machine to sleep might be a good idea.
It has these resources: cronfiles (a list of files where cron jobs might be lurking – for instance /etc/crontab); crondirs (a list of directories in which to look for more cron files – for instance /var/spool/cron); suspendcommand; waketimefile (where the system looks for a wake time – this varies according to kernel version).
It’s written in Perl, which I’ve studiously avoided for years but which turns out to be far more manageable than before now that I know about O’Reilly’s Perl Cookbook – so much more clear and helpful for the impatient would-be Perl programmer than the desperately irritating Programming Perl, with its acres of intrusive jokes and its hundreds of irrelevant and outlandish clever edge cases which I really don’t want to know about when I just want a reminder and clear explanation of how to do something, dammit.
Hmm. I’ve just realised that although it handles cron jobs successfully, the component doesn’t know about at jobs at all.
Drat!