systemd integration

Even though it is possible to run autosuspend manually (cf. the manpage), in production use cases, the daemon will usually be run from systemd. For this purpose, the package ships with service definition files for systemd, so that you should be able to manage autosuspend via systemd. These files need to be installed in the appropriate locations for such service files, which depend on the Linux distribution. Some common locations are: * /usr/lib/systemd/system (e.g. Archlinux packaged service files) * /lib/systemd/system (e.g. Debian packaged service files) * /etc/systemd/system (e.g. Archlinux manually added service files) Binary installation packages for Linux distributions should have installed the service files at the appropriate locations already.

To start autosuspend via systemd, execute:

systemctl enable autosuspend.service

To start autosuspend automatically at system start, execute:

systemctl start autosuspend.service

Preventing the system from sleeping immediately after waking up

Unfortunately, autosuspend does not detect automatically if the system was placed into suspend mode manually. Therefore, it might happen that after waking up again, all checks have indicated inactivity for a long time (the whole phase of sleeping) and autosuspend might initiate suspending again immediately. To prevent this, systemd needs to inform autosuspend every time the system suspends. This is achieved by a seconds service file, which needs to be enabled (not started):

systemctl enable autosuspend-detect-suspend.service