Looking at the output from a couple of ps commands that can detect the various versions of systemd & upstart, which could be crafted like so:
$ ps -eaf|grep [u]pstart'[u]pstart' root 492 1 0 Jan02 ? 00:00:00 upstart-udev-bridge --daemon root 1027 1 0 Jan02 ? 00:00:00 upstart-socket-bridge --daemon $ ps -eaf|grep [s]ystemd'[s]ystemd' root 1 0 0 07:27 ? 00:00:03 /usr/lib/systemd/systemd --switched-root --system --deserialize 20 root 343 1 0 07:28 ? 00:00:03 /usr/lib/systemd/systemd-journald root 367 1 0 07:28 ? 00:00:00 /usr/lib/systemd/systemd-udevd root 607 1 0 07:28 ? 00:00:00 /usr/lib/systemd/systemd-logind dbus 615 1 0 07:28 ? 00:00:13 /bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation Paying attention to what the name of the process is that's PID #1 can also potentially shed potential light on which init system is being used. On Fedora 19 (which uses systemd, for example:
$ (ps -eo "ppid,args" 2>/dev/null || echo "ps call error") \ | awk 'NR==1 || $1==1' | less PPID COMMAND 1 /lib/systemd/systemd-journald 1 /lib/systemd/systemd-udevd 1 /lib/systemd/systemd-timesyncd ... ps call successful If you interrogate the init executable, you can get some info from it as well. Simply parsing the --version output. For example:
NOTE: The fact that init is not in its standard location is a bit of a hint/tell. It's always located on sysvinit systems in /sbin/init on sysvinit systems.
So there doesn't appear to be anyoneany one way to do it, but you could formulate a suite of checks that would pinpoint which init system you're using with a fairly high degree of confidence.