autosuspend - a daemon to automatically suspend and wake up a system

Warning

This is the documentation for an unreleased preview version of autosuspend.

autosuspend is a daemon that periodically suspends a system on inactivity and wakes it up again automatically in case it is needed. For this purpose, autosuspend periodically iterates a number of user-configurable activity checks, which indicate whether an activity on the host is currently present that should prevent the host from suspending. In case one of the checks indicates such activity, no action is taken and periodic checking continues. Otherwise, in case no activity can be detected, this state needs to be present for a specified amount of time before the host is suspended by autosuspend. In addition to the activity checks, wake up checks are used to determine planned future activities of the system (for instance, a TV recording or a periodic backup). In case such activities are known before suspending, autosuspend triggers a command to wake up the system automatically before the soonest activity.

The following diagram visualizes the periodic processing performed by autosuspend.

@startuml

skinparam shadowing false
skinparam backgroundcolor transparent

skinparam Padding 8

skinparam ActivityBackgroundColor #FFFFFF
skinparam ActivityDiamondBackgroundColor #FFFFFF
skinparam ActivityBorderColor #333333
skinparam ActivityDiamondBorderColor #333333
skinparam ArrowColor #333333

start

:Execute activity checks;

if (Is the system active?) then (no)

  if (Was the system idle before?) then (no)
    :Remember current time as start of system inactivity;
  else (yes)
  endif

  if (Is system idle long enough?) then (yes)

    :Execute wake up checks;

    if (Is a wake up required soon?) then (yes)
      stop
    else
      if (Is any wake up required?) then (yes)
        #BBFFBB:Schedule the earliest wake up;
      else (no)
      endif
    endif

    #BBFFBB:Suspend the system;

  else (no)
    stop
  endif

else (yes)
  :Forget start of system inactivity;
  stop
endif

stop

@enduml

Indices and tables