0

This question already has an answer here:

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 .mount files.

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.

marked as duplicate by terdon, Anthon, slm, rahmu, Zelda Jan 20 '14 at 18:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Which OS and/or distribution? Or are you looking for a generic answer? – Nils Jan 20 '14 at 11:27
  • I'm afraid this is a duplicate of the question you linked to. No, the answers are not perfect but I think they're the best you can get. The quick answer as far as I can tell is "You can't. Sorry." – terdon Jan 20 '14 at 17:19