systemd
Tartalomjegyzék
Basic usage
systemctl start apache2
systemctl stop apache2
systemctl enable apache2
systemctl disable apache2
systemctl status apache2
networkd
Config files:
/etc/systemd/network
DNS=... DHCP=.. Gateway=.. Address=.. Domains=.. ...
Check man systemd.network
tmpfiles.d, /var/run persistency
With the adoption of systemd, there is now a centralized mechanism for the creation of temporary files and directories. A service wishing to use this method can remove mkdir commands in its own startup script and instead place a .conf file in /etc/tmpfiles.d, /run/tmpfiles.d, or /usr/lib/tmpfiles.d, with Ubuntu services seeming to prefer the last option.
The format of these files is the following:
#Type Path Mode UID GID Age Argument d /run/user 0755 root root 10d - L /tmp/foobar - - - - /dev/null
Further information can be found using man tmpfiles.d
Init scripts
Init scripts are located here:
/etc/systemd/system/ /lib/systemd/system/ ...
Example init scripts:
[Unit] Description=Calibre Server After=network.target StartLimitIntervalSec=500 StartLimitBurst=5 [Service] Type=forking PIDFile=/var/run/calibre-server.pid Restart=on-failure RestartSec=5s ExecStart=/usr/bin/calibre-server \ --daemonize \ --port 32452 \ --pidfile /run/calibre-server.pid \ --enable-local-write \ --log=/var/log/calibre.log \ /home/calibre/db \ /home/calibre/en \ /home/calibre/romantikus \ /home/calibre/paperbooks [Install] WantedBy=multi-user.target
[Unit] Description=Calibre Book Importer After=network.target calibre.service [Service] Type=oneshot ExecStart=/home/calibre/import-books.sh KillMode=mixed [Install] WantedBy=multi-user.target
Types
- forking
- oneshot
- …
# TODO!!!
Reload init scripts config
systemctl daemon-reload
systemd.txt · Utolsó módosítás: 2022/02/23 13:17 szerkesztette: daevidt
