Difference between revisions of "Systemd debian"

From Teknologisk videncenter
Jump to: navigation, search
m (Links)
m
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
*Scriptfiles in /lib/systemd/system - See exampels of servicefiles there - add your own new system service:
 +
<source lang=bash>
 +
...:~$ sudo systemd-analyze verify YOUR_SERVICEFILE
 +
...:~$ sudo systemctl daemon-reload
 +
...:~$ sudo systemctl enable YOUR_SERVICEFILE
 +
...:~$ sudo systemctl YOUR_SERICEFILE
 +
</source>
 +
=Often used=
 +
<source lang=bash>
 +
# systemctl start [name.service]
 +
# systemctl stop [name.service]
 +
# systemctl restart [name.service]
 +
# systemctl reload [name.service]
 +
$ systemctl status [name.service]
 +
# systemctl is-active [name.service]
 +
$ systemctl list-units --type service --all
 +
$ systemctl show [name.service]
 +
</source>
 +
=Dependencies=
  
 +
<source lang=bash>
 +
systemctl list-dependencies
 +
</source>
 +
=Writing your own systemd services=
 +
*[[systemd service file]] example
 +
==Links==
 +
*See [https://man7.org/linux/man-pages/man7/daemon.7.html man page daemon(7)]
 +
*[https://linuxhandbook.com/create-systemd-services/ Create systemd services]
 +
*[https://www.freedesktop.org/software/systemd/man/latest/systemd.service.html?ref=linuxhandbook.com#Options Systemd.servce - service unit configuration]
 +
*[https://medium.com/@benmorel/creating-a-linux-service-with-systemd-611b5c8b91d6 Creating a Linux service with systemd]
  
 
=Links=
 
=Links=

Latest revision as of 05:14, 17 April 2024

  • Scriptfiles in /lib/systemd/system - See exampels of servicefiles there - add your own new system service:
...:~$ sudo systemd-analyze verify YOUR_SERVICEFILE
...:~$ sudo systemctl daemon-reload
...:~$ sudo systemctl enable YOUR_SERVICEFILE
...:~$ sudo systemctl YOUR_SERICEFILE

Often used

# systemctl start [name.service]
# systemctl stop [name.service]
# systemctl restart [name.service]
# systemctl reload [name.service]
$ systemctl status [name.service]
# systemctl is-active [name.service]
$ systemctl list-units --type service --all
$ systemctl show [name.service]

Dependencies

systemctl list-dependencies

Writing your own systemd services

Links

Links