The following checks for activity are currently implemented. Each of the is described with its available configuration options and required optional dependencies.
check-active-calendar-event
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.
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.
check-active-connection
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.
ports
list of comma-separated port numbers
check-external-command
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.
external-command-activity-scripts
for a collection of user-provided scripts for some common use cases.
command
The command to execute including all arguments
check-jsonpath
A generic check which queries a configured URL and expects the reply to contain JSON data. The returned JSON document is checked against a configured JSONPath expression and in case the expression matches, the system is assumed to be active.
url
The URL to query for the XML reply.
jsonpath
The JSONPath 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.
check-kodi
Checks whether an instance of Kodi is currently playing.
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
check-kodi-idle-time
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 check-xidletime
on systems using an X server, but might be necessary in case Kodi is used standalone. It does not replace the check-kodi
check, as the idle time is not updated when media is playing.
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.
check-last-log-activity
Parses a log file and uses the most recent time contained in the file to determine activity. For this purpose, the log file lines are iterated from the back until a line matching a configurable regular expression is found. This expression is used to extract the contained timestamp in that log line, which is then compared to the current time with an allowed delta. The check only looks at the first line from the back that contains a timestamp. Further lines are ignored. A typical use case for this check would be a web server access log file.
This check supports all date formats that are supported by the dateutil parser.
log_file
path to the log file that should be analyzed
pattern
A regular expression used to determine whether a line of the log file contains a timestamp to look at. The expression must contain exactly one matching group. For instance, ^\[(.*)\] .*$
might be used to find dates in square brackets at line beginnings.
minutes
The number of minutes to allow log file timestamps to be in the past for detecting activity. If a timestamp is older than <now> - <minutes>
no activity is detected. default: 10
encoding
The encoding with which to parse the log file. default: ascii
timezone
The timezone to assume in case a timestamp extracted from the log file has not associated timezone information. Timezones are expressed using the names from the Olson timezone database (e.g. Europe/Berlin
). default: UTC
check-load
Checks whether the system load 5 is below a certain value.
threshold
a float for the maximum allowed load value, default: 2.5
check-logind-session-idle
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
.
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
check-mpd
Checks whether an instance of MPD is currently playing music.
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
check-network-bandwidth
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 <config-general interval>
option.
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
check-ping
Checks whether one or more hosts answer to ICMP requests.
hosts
Comma-separated list of host names or IPs.
check-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.
processes
list of comma-separated process names to check for
check-smb
Any active Samba connection will block suspend.
smbstatus
executable needs to be present.
check-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.
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: .*
.
check-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.
timeout
required idle time in seconds
method
The method to use for acquiring running X sessions. Valid options are sockets
and logind
. The default is sockets
.
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.
- dbus-python for the
logind
method
check-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]
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.