2010-11-02
Now I use the home workstation jobs more ...
Attention: this item is more than 5 years old, links can be broken and information can have been updated.
Now I use the home workstation jobs more for audio work I also want that data in the backup cycle on a regular basis. But backups happen when I sleep and normally the system is off when not in use.Solution: kick the workstation awake using wake-on-lan. That is easy when I know the ethernet address for the active network card and set the system up right (which does mean the power use is non-zero).
18 5 * * Mon,Fri /usr/sbin/etherwake -i eth0.1 jobsNicely in sync with the backup scheme. But that does mean the system is running which is not needed after the backup is done. But sometimes I leave it running overnight for some computation task(s). Solution, a script on the workstation which runs when the backup should be done at 07:10, somewhat less than 2 hours after the wake:#!/bin/sh # check if I'm awaken for backup, in that case: shutdown when there is no # amanda process if [ "`awk ' $1 < 7200 { print "ja" } ' < /proc/uptime`" = "ja" ]; then if [ "`pidof amandad`" = "" ]; then /sbin/shutdown -h now fi fiOnly when the number of seconds uptime is less than 7200 (2 hours) and there is no amanda daemon left, the system will shutdown. Scheduled backups working, no needless running of the system and when it has been started with other reasons it won't shut down.
The detour via awk is because the -lt option of test doesn't like fractional numbers.