Available activity checks
The following checks for activity are currently implemented. Each of the is described with its available configuration options and required optional dependencies.
ActiveCalendarEvent
Checks an online iCalendar file for events that are currently running. If so, this indicates activity and prevents suspending the system. Thus, a calendar can be provided with times at which the system should not go to sleep. If this calendar resides on an online service like a groupware it might even be possible to invite the system.
Options
- url
The URL to query for the iCalendar file
- timeout
Timeout for executed requests in seconds. Default: 5.
- username
Optional user name to use for authenticating at a server requiring authentication. If used, also a password must be provided.
- password
Optional password to use for authenticating at a server requiring authentication. If used, also a user name must be provided.
Requirements
ActiveConnection
Checks whether there is currently a client connected to a TCP server at certain ports. Can be used to e.g. block suspending the system in case SSH users are connected or a web server is used by clients.
Options
- ports
list of comma-separated port numbers
Requirements
ExternalCommand
Executes an arbitrary command. In case this command returns 0, the system is assumed to be active.
The command is executed as is using shell execution. Beware of malicious commands in obtained configuration files.
Options
- command
The command to execute including all arguments
Requirements
Kodi
Checks whether an instance of Kodi is currently playing.
Options
- url
Base URL of the JSON RPC API of the Kodi instance, default:
http://localhost:8080/jsonrpc
- timeout
Request timeout in seconds, default:
5
- username
Optional user name to use for authenticating at a server requiring authentication. If used, also a password must be provided.
- password
Optional password to use for authenticating at a server requiring authentication. If used, also a user name must be provided.
- suspend_while_paused
Also suspend the system when media playback is paused instead of only suspending when playback is stopped. Default:
false
Requirements
KodiIdleTime
Checks whether there has been interaction with the Kodi user interface recently. This prevents suspending the system in case someone is currently browsing collections etc. This check is redundant to XIdleTime on systems using an X server, but might be necessary in case Kodi is used standalone. It does not replace the Kodi check, as the idle time is not updated when media is playing.
Options
- idle_time
Marks the system active in case a user interaction has appeared within the this amount of seconds until now. Default:
120
- url
Base URL of the JSON RPC API of the Kodi instance, default:
http://localhost:8080/jsonrpc
- timeout
Request timeout in seconds, default:
5
- username
Optional user name to use for authenticating at a server requiring authentication. If used, also a password must be provided.
- password
Optional password to use for authenticating at a server requiring authentication. If used, also a user name must be provided.
Requirements
Load
Checks whether the system load 5 is below a certain value.
Options
- threshold
a float for the maximum allowed load value, default: 2.5
Requirements
LogindSessionsIdle
Prevents suspending in case IdleHint
for one of the running sessions logind sessions is set to no
.
Support for setting this hint currently varies greatly across display managers, screen lockers etc.
Thus, check exactly whether the hint is set on your system via loginctl show-session
.
Options
- types
A comma-separated list of sessions types to inspect for activity. The check ignores sessions of other types. Default:
tty
,x11
,wayland
- states
A comma-separated list of session states to inspect. For instance,
lingering
sessions used for background programs might not be of interest. Default:active
,online
Requirements
Mpd
Checks whether an instance of MPD is currently playing music.
Options
- host
Host containing the MPD daemon, default:
localhost
- port
Port to connect to the MPD daemon, default:
6600
- timeout
Request timeout in seconds, default:
5
Requirements
NetworkBandwidth
Checks whether more network bandwidth is currently being used than specified.
A set of specified interfaces is checked in this regard, each of the individually, based on the average bandwidth on that interface.
This average is based on the global checking interval specified in the configuration file via the interval
option.
Options
- interfaces
Comma-separated list of network interfaces to check
- threshold_send <byte/s>
If the average sending bandwidth of one of the specified interfaces is above this threshold, then activity is detected. Specified in bytes/s, default:
100
- threshold_receive <byte/s>
If the average receive bandwidth of one of the specified interfaces is above this threshold, then activity is detected. Specified in bytes/s, default:
100
Requirements
Ping
Checks whether one or more hosts answer to ICMP requests.
Options
- hosts
Comma-separated list of host names or IPs.
Requirements
Processes
If currently running processes match an expression, the suspend will be blocked. You might use this to hinder the system from suspending when for example your rsync runs.
Options
- processes
list of comma-separated process names to check for
Requirements
Smb
Any active Samba connection will block suspend.
Options
- smbstatus
executable needs to be present.
Requirements
Users
Checks whether a user currently logged in at the system matches several criteria. All provided criteria must match to indicate activity on the host.
Options
All regular expressions are applied against the full string. Capturing substrings needs to be explicitly enabled using wildcard matching.
- name
A regular expression specifying which users to capture, default:
.*
.
- terminal
A regular expression specifying the terminal on which the user needs to be logged in, default:
.*
.
- host
A regular expression specifying the host from which a user needs to be logged in, default:
.*
.
Requirements
XIdleTime
Checks whether all active local X displays have been idle for a sufficiently long time. Determining which X11 sessions currently exist on a running system is a harder problem than one might expect. Sometimes, the server runs as root, sometimes under the real user, and many other configuration variants exist. Thus, multiple sources for active X serer instances are implemented for this check, each of them having different requirements and limitations. They can be changed using the provided configuration option.
Options
- timeout
required idle time in seconds
- method
The method to use for acquiring running X sessions. Valid options are
sockets
andlogind
. The default issockets
.sockets
Uses the X server sockets files found in
/tmp/.X11-unix
. This method requires that all X server instances run with user permissions and not as root.logind
Uses logind to obtain the running X server instances. This does not support manually started servers.
- ignore_if_process
A regular expression to match against the process names executed by each X session owner. In case the use has a running process that matches this expression, the X idle time is ignored and the check continues as if there was no activity. This can be useful in case of processes which inevitably tinker with the idle time.
- ignore_users
Do not check sessions of users matching this regular expressions.
Requirements
dbus-python for the
logind
method
XPath
A generic check which queries a configured URL and expects the reply to contain XML data. The returned XML document is checked against a configured XPath expression and in case the expression matches, the system is assumed to be active.
Some common applications and their respective configuration are:
- tvheadend
The required URL for tvheadend is (if running on the same host):
http://127.0.0.1:9981/status.xml
In case you want to prevent suspending in case there are active subscriptions or recordings, use the following XPath:
/currentload/subscriptions[number(.) > 0] | /currentload/recordings/recording/start
If you have a permantently running subscriber like Kodi, increase the
0
to1
.- Plex
For Plex, use the following URL (if running on the same host):
http://127.0.0.1:32400/status/sessions/?X-Plex-Token={TOKEN}
Where acquiring the token is documented here.
If suspending should be prevented in case of any activity, this simple XPath expression will suffice:
/MediaContainer[@size > 2]
Options
- url
The URL to query for the XML reply.
- xpath
The XPath query to execute. In case it returns a result, the system is assumed to be active.
- timeout
Timeout for executed requests in seconds. Default: 5.
- username
Optional user name to use for authenticating at a server requiring authentication. If used, also a password must be provided.
- password
Optional password to use for authenticating at a server requiring authentication. If used, also a user name must be provided.