Systemd usage: Difference between revisions
From wikinotes
Line 28: | Line 28: | ||
</blockquote><!-- Service Management --> | </blockquote><!-- Service Management --> | ||
= | = System Management = | ||
<blockquote> | <blockquote> | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> |
Revision as of 17:29, 11 December 2022
Documentation
man systemctl
https://man.archlinux.org/man/core/systemd/systemctl.1.en
Service Management
systemctl {list-units,list-timers,list-sockets} systemctl {enable,start,stop,restart} myservice systemctl {is-active,is-enabled} myservice systemctl show \ [-p property,...] `# list specific properties` \ [foo.service] `# filter to unitfile` \ # list filepaths for each service for service in $(systemctl list-units -t service,timer | head -n -6 | sed -n '2,$p' | sed -E 's/^[^a-zA-Z0-9]+//' | awk -F' ' '{ print $1 }'); do systemctl show -P Id,FragmentPath "$service" | sed 'N;s/\n/ /' done | column -t
System Management
systemctl --system daemon-reload # reload unitfiles systemctl [--user] list-units -t target # list all targets
Logs
See systemd journald