#!/bin/bash PM_HIBERNATE_DELAY=1800 # 30 minutes PM_RTC=/sys/class/rtc/rtc0 PM_LOGFILE="/var/log/super_sleep.log" log() { is_set "$LOGGING" || return 0; local fmt='%s\n' [ "$1" = "-n" ] && { fmt='%s'; shift; } printf "$fmt" "$*" } WAKETIME=$(( $(cat "$PM_RTC/since_epoch") + PM_HIBERNATE_DELAY)) echo >"$PM_RTC/wakealarm" echo $WAKETIME > "$PM_RTC/wakealarm" if s2ram; then NOW=$(cat "$PM_RTC/since_epoch") if [ "$NOW" -ge "$WAKETIME" -a "$NOW" -lt $((WAKETIME + 30)) ]; then log "Woken by RTC alarm, hibernating." # if hibernate fails for any reason, go back to suspend. s2disk || s2ram else echo > "$PM_RTC/wakealarm" fi else # if we cannot suspend, just try to hibernate. s2disk fi
Взят отсюда:
http://www.linux.org.ru/forum/desktop/10797723