0

I was using the following command to check whether system uses systemd
if [[ 1 == pidof systemd ]]; then

But this fails in chroot since proc is not mounted.

sh-4.2# pidof systemd sh-4.2# ps Error, do this: mount -t proc proc /proc

What alternative method can be used to check whether system uses systemd or sysv?

nithinj
  • 21

1 Answers1

0

You can check if /sbin/init is a symlink to systemd. This isn't as good as the ps method because it's possible (but unlikely) that something besides /sbin/init is pid 1.

if [[ `file /sbin/init | grep -q systemd && echo 1` = 1 ]]