autosuspend.conf¶
Synopsis¶
/etc/autosuspend.conf
Description¶
Configures the autosuspend daemon.
Syntax¶
The autosuspend configuration file uses INI syntax and needs to be processable by the Python configparser module.
A simple configuration file could look like:
[general]
interval = 30
idle_time = 900
suspend_cmd = /usr/bin/systemctl suspend
[check.Ping]
enabled = false
hosts = 192.168.0.7
[check.RemoteUsers]
class = Users
enabled = true
name = .*
terminal = .*
host = [0-9].*
The configuration file consists of a [general]
section, which specifies general processing options, and multiple options of the format [check.*]
.
These sections describe the checks to execute to determine inactivity.
General Configuration¶
The [general]
section contains options controlling the overall behavior of the autosuspend daemon. These are:
-
interval
¶
The time to wait after executing all checks in seconds.
-
idle_time
¶
The required amount of time in seconds with no detected activity before the host will be suspended.
-
suspend_cmd
¶
The command to execute in case the host shall be suspended. This line can contain additional command line arguments to the command to execute.
Check Configuration¶
For each check to execute, a section with the name format [check.*]
needs to be created.
Each check has a name and an executing class which implements the behavior.
The fraction of the section name check.
determines the name, and in case no class option is given inside the section, also the class which implements the check.
In case the option:`class option is specified, the name is completely user-defined and the same check can even be instantiated multiple times with differing names.
For each check, these generic options can be specified:
-
class
¶
Name of the class implementing the check. If this is not specified, the section name must represent a valid check class (see list below).
-
enabled
¶
Needs to be
true
for a check to actually execute.false
is assumed if not specified.
Furthermore, each check might have custom options.
Available checks¶
The following checks for activity are currently implemented. Each of the is described with its available configuration options and required optional dependencies.
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¶
Kodi¶
Checks whether an instance of Kodi is currently playing.
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¶
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.
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.
Requirements¶
XIdleTime¶
Checks whether all active local X displays have been idle for a sufficiently long time. This assumes a recent operating system where the X server is started with user permissions (i.e. not as root).
Options¶
-
timeout
¶
required idle time in seconds
-
ignore_if_process
¶
a regular expression to match against the process names executed by each X session owner. In case the use has a process running, which matches against this expression, the X idle time is ignore and the check continues as if there was no activity. This can be useful in case of processes which inevitabl
The options of individual checks are outlined below.