I meant to get back about this before but I forgot.
Adding a script to "/etc/pm/sleep.d" was the solution with authshutdown installed.
I have added a script called "01-set-wakeup" and set it executable.
Bash
#!/bin/bash
set_wakeup_time()
{
WAKE_AT=22:00:00
NOW=`date +%s`
WAKE_TODAY=`date -d "today ${WAKE_AT}" +%s`
WAKE_TOMORROW=`date -d "tomorrow ${WAKE_AT}" +%s`
if [ $NOW -gt $WAKE_TODAY ]; then
WAKE_AT=$WAKE_TOMORROW
else
WAKE_AT=$WAKE_TODAY
fi
logger "Set rtcwake for "`date --date=@$WAKE_AT`
rtcwake -a -m no -t $WAKE_AT
}
case "$1" in
hibernate|suspend)
set_wakeup_time
;;
thaw|resume)
# Do nothing
;;
*)
logger -s -t "$USER set-wakeup [$$]" "other: set-wakeup call from /etc/pm/sleep.d/set-wakeup"
;;
esac
Alles anzeigen
This gets called when pm-suspend is called and set the RTC to wake up my server at 22:00 local.
At 22:04 my backup is started by cron and dirvish mounts my external USB drive, does an incremental backup and then unmounts the drive.
It would be nice if enabling and setting the time was a standard part of the WOL-RTC plugin though.
So I'm happy that my backup is now running automatically every evening.