Skip to content
This repository was archived by the owner on Aug 29, 2023. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions etc/autosuspend
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ DONT_SUSPEND_BY_DAY='no'
# Automatically reboot once a week when the system isn't in use
REBOOT_ONCE_PER_WEEK='yes'

# Allow suspend when no wakeup time exists
SUSPEND_WITHOUT_WAKEUP='no'

# Daemons that always have one process running, only if more that one process is active we prevent the suspend
# The values are used with grep, so just a unique portion is sufficient
DAEMONS=''
Expand Down
6 changes: 5 additions & 1 deletion usr/local/sbin/autosuspend.main
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,11 @@ if [ "$AUTO_SUSPEND" = "true" ] || [ "$AUTO_SUSPEND" = "yes" ] ; then
logit "Suspend method: $suspend_method"
SetWakeupTime
wakeup_time=$(cat /sys/class/rtc/rtc0/wakealarm)
if [[ "$wakeup_time" -le $(date +%s) ]]; then
if [[ -z "$wakeup_time" ]] && [[ "${SUSPEND_WITHOUT_WAKEUP:-no}" != "yes" ]]; then
logit "Aborting suspend because of missing wakeup time"
exit 3
fi
if [[ -n "$wakeup_time" ]] && [[ "$wakeup_time" -le $(date +%s) ]]; then
logit "Aborting suspend because wakeup time" $(date --date @$wakeup_time) "is in the past"
exit 2
fi
Expand Down