diff --git a/etc/autosuspend b/etc/autosuspend index 151df08..20bca86 100644 --- a/etc/autosuspend +++ b/etc/autosuspend @@ -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='' diff --git a/usr/local/sbin/autosuspend.main b/usr/local/sbin/autosuspend.main index 88512c9..cc6859e 100755 --- a/usr/local/sbin/autosuspend.main +++ b/usr/local/sbin/autosuspend.main @@ -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