This question already has an answer here:
- Detect init system using the shell 18 answers
I have to create a script that will mount my /usr folder as aufs.
I compressed it using squashfs. I've managed to install a working systemd init in ubuntu which I am currently using. Because the mounting procedure in systemd is almost parallel, relying on fstab will not work and I have to use
.mount scripts. The reason why I could not rely on fstab is because it is required to mount the squashfs as readonly first then I would remount it as aufs for it to be read-write. When I use upstart again, the script shall work assisting the fstab and also mounting the /usr as aufs in the process. I am almost done with the script but my script should not work when I use systemd because it may collide with the
Is there any way to check whether I run systemd or upstart in a bash script?
I tried using
if [ -e /sys/fs/cgroup/systemd ] ; then exit 2 but it did not work when I use upsatrt.
I've also check this but it doesn't answer my question completely.