For When You Can't Have The Real Thing
[ start | index | login ]
start > Fedora > 35 > systemd

systemd

Created by dave. Last edited by dave, one year and 334 days ago. Viewed 491 times. #3
[diff] [history] [edit] [rdf]
labels
attachments
(2017-01-23)

God Dammit

WhatHow
List services as calculated as being required for run statesystemctl list-units
systemctl list-units --all
systemctl list-units --all --state=inactive
Start service at boot timesystemctl enable service
List all servicessystemctl list-unit-files
Start service nowservice service start
systemctl start service
Show unit filesystemctl cat service.service
Show dependenciessystemctl list-dependencies service.service
Show unit propertiessystemctl show service.service
systemctl show service.service -p Confilcts
Masking (make service completely un-runnable)systemctl mask service.service
systemctl unmask service.service
Editing"snippet": systemctl edit service.service
Full unit file: systemctl edit --full service.service

OneShot

[Unit]
Description=Setup Ramdisk For Nagios
After=network.target

[Service] Type=oneshot ExecStart=/usr/local/sbin/setup-nagios-ramdisk RemainAfterExit=true ExecStop=/bin/true StandardOutput=journal

[Install] WantedBy=multi-user.target

Indicate Dependency On Another Service

[Unit]
Description=Nagios Core 4.4.6
Documentation=https://www.nagios.org/documentation
After=network.target local-fs.target setup-nagios-ramdisk.service

[...]

Note that in this case, indicating a dependency on a one-shot that doesn't leave anthing behind, systemd won't run the dependency before running what you've asked for.

ie, if nagios-setup-ramdisk.service has not been executed since boot, starting nagios.service will result in an error (because the local nagios configuration can't find the pieces that the setup one-shot creates for it).

Oldie-style sysv-init files

Read about how systemd deals with non-systemd-native stuff: >>here

no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt