Difference between revisions of "Systemctl"
Jump to navigation
Jump to search
↑ https://www.freedesktop.org/software/systemd/man/systemctl.html
↑ https://www.linuxtrainingacademy.com/systemd-cheat-sheet/
↑ https://wiki.ubuntu.com/DebuggingSystemd
Line 22: | Line 22: | ||
** <code>[[systemctl list-unit-files]] --state=enabled</code> | ** <code>[[systemctl list-unit-files]] --state=enabled</code> | ||
* List services enabled: <code>systemctl list-unit-files --state=enabled</code> | * List services enabled: <code>systemctl list-unit-files --state=enabled</code> | ||
− | * Show properties: <code>systemctl show sshd.service</code> | + | * Show properties: |
+ | ** <code>[[systemctl show]] sshd.service</code> | ||
* View dependencies: <code>systemctl list-dependencies sshd.service</code> | * View dependencies: <code>systemctl list-dependencies sshd.service</code> | ||
* Creating new services in: <code>/etc/systemd/system/</code> https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-unit_files | * Creating new services in: <code>/etc/systemd/system/</code> https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-unit_files |
Revision as of 06:45, 17 December 2020
systemctl
command is used to control the systemd system and service manager.[1]
Services configuration directory:
/etc/systemd/system/ sshd.service
Basic Usage
systemctl status
orsystemctl status SERVICE_NAME
systemctl stop
SERVICE_NAMEsystemctl start
SERVICE_NAMEsystemctl restart
SERVICE_NAMEsystemctl reload
SERVICE_NAMEsystemctl cat SERVICE_NAME
orsystemctl cat SERVICE_NAME.service
systemctl list-timers
systemctl list-units
systemctl list-units --all
systemctl list-units --failed
systemctl list-units --type=service
- List services:
systemctl list-unit-files
[2]systemctl list-unit-files --state=enabled
- List services enabled:
systemctl list-unit-files --state=enabled
- Show properties:
systemctl show sshd.service
- View dependencies:
systemctl list-dependencies sshd.service
- Creating new services in:
/etc/systemd/system/
https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/sect-managing_services_with_systemd-unit_files systemctl -t mount
systemctl list-units -t mount
systemctl enable FS_UNIT_NAME.mount
sudo systemctl enable --now snapd.socket
systemctl disable SERVICE_NAME
systemctl --type swap
systemctl daemon-reload
systemctl unmask
Activities
Basic
- Read systemd Cheat-sheet: https://www.linuxtrainingacademy.com/systemd-cheat-sheet/
- Enable or disable Automatic updates in your Ubuntu machine
Advanced
- Read Why are reboot, shutdown and poweroff symlinks to systemctl?: https://unix.stackexchange.com/questions/77029/why-are-reboot-shutdown-and-poweroff-symlinks-to-systemctl/77030#77030
- Create a service that restart on-failure. https://superuser.com/questions/507576/how-to-automatically-restart-a-linux-background-process-if-it-fails
Related terms
See also
- Systemd:
systemctl
,systemd-journald
,journalctl
systemd-cat
,systemd-logind
,systemd-networkd
:networkctl
,systemd-timesyncd
,systemd-resolved
,systemd-udevd
[3],Systemd-logind: loginctl
,hostnamectl
,udevadm
,systemd-run
,portablectl
,systemd-nspawn
, systemd resource management, Timer (systemd), systemd logs,/etc/systemd/
, systemd services,systemd-mount
,/run/systemd/
,.service
,/usr/lib/systemd/
,/usr/lib/systemd/system/
,/usr/lib/systemd/system/systemd-resolved.service
,/lib/systemd/
, machinectl, systemd-oomd, systemd-analyze - Systemd services:
systemctl
[status | is-active | start | daemon-reload | stop | mask
|reload
|restart
|reboot
|enable
|disable
|cat
],systemctl list-units
,systemctl list-timers
,systemctl --failed
,systemctl get-default
,systemctl --help
,.service, .timer, .socket
,systemctl restart elasticsearch.service
,systemctl status apt-daily
,systemctl status oscapd
- KVM services
Advertising: