Felipe's Blog

Your go-to source for Linux/Unix-like – tech – engineering.

Archive for the ‘demon’ tag

Creating a systemd service for xscreensaver

without comments

First, is to define a systemd service:

$ cat > ~/.config/systemd/user/xscreensaver.service <<EOF
[Unit]
Description=XScreenSaver
After=network.target

[Service]
ExecStart=/usr/bin/xscreensaver -nosplash
Restart=always
RestartSec=3

[Install]
WantedBy=default.target
EOF

Then,

$ systemctl --user enable xscreensaver.service
$ systemctl --user start xscreensaver.service
$ systemctl --user status xscreensaver.service

BTW it could appear to fail at first if the xscreensaver daemon is already running. In that case, do:

$ pkill xscreensaver

Then check the status again, and it should now be active.

$ systemctl –user status xscreensaver.service

Written by Felipe

January 1st, 2024 at 2:50 am