1

On my debian 10 server pidof systemd gives no result, although there are pids:

# pgrep systemd -la
1 /sbin/init
256 /lib/systemd/systemd-journald
275 /lib/systemd/systemd-udevd
282 /lib/systemd/systemd-timesyncd
355 /lib/systemd/systemd-logind

I would like to check in a general bash-install-script, if the current system uses systemd

rubo77
  • 28,966

1 Answers1

4

The documented way to check that systemd is managing the running system is to check for the existence of the /run/systemd/system directory. If it exists, systemd booted the system.

See also Detect init system using the shell.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Stephen Kitt
  • 434,908