5

I want to write a script to enable my program on boot automatically. This can be done using SysV Init, Upstart or systemd. However, I am not able to figure out which init system my Raspbian uses.

Another doubt I have is that, suppose the default init system is upstart, then will a script written and enabled with systemd work? To rephrase, do we need to write init script in the default init system to make it work?

Will
  • 371
  • 3
  • 16
Adi
  • 151
  • 1
  • 6

1 Answers1

5

Raspian is basically Debian.

Debian until and including Wheezy/7 used SysV, since Jessie/8 systemd.

Upstart is not relevant anymore, since even RHEL and Ubuntu (the Upstart developers) have moved to systemd.

systemd is very different from sysv. However, there is a compatibility layer in systemd that will transparently create units for properly annotated sysv init scripts on the fly. If you plan to distribute your init script to other raspian users, a well-tested sysv init script will also work in systemd. While systemd is pretty complex, creating services is actually surprisingly simple.

As for the init system on your machine, stat /sbin/init should give you a good indication on Debian. For general initsystem detection, this Unix&Linux question has excellent answers. u

kba
  • 312
  • 1
  • 8