Systemd
Jump to navigation
Jump to search
Usage
systemd:0
means first systemd socket defined in the .socket file (FD 3),systemd:1
is the second (FD 4) and so on.
Configure a service to start at boot
sudo systemctl enable courier-authdaemon
Create a new service
From SE:
- Create a file /etc/systemd/system/foo.service
[Unit]
Description=foo
[Service]
ExecStart=/bin/bash -c "while true; do /bin/inotifywait -qq --event close_write /sys/class/backlight/acpi_video0/brightness; su myusername -c '/bin/xbacklight -display :0 -set $(cat /sys/class/backlight/acpi_video0/brightness)'; done"
[Install]
WantedBy=multi-user.target
Reload systemd:
systemctl daemon-reload
Enable the new service:
systemctl enable foo
The service will start automatically at boot. To start it immediately:
systemctl start foo
systemctl status foo # optional, just to verify
Example of options to add in the service file:
[Unit]
Description=rapid spam filtering system
After=nss-lookup.target
[Service]
ExecStart=/usr/bin/rspamd -c /etc/rspamd/rspamd.conf -f
User=_rspamd
RuntimeDirectory=rspamd
RuntimeDirectoryMode=0755
Restart=always
[Install]
WantedBy=multi-user.target