[Pkg-sysvinit-devel] Two line init.d scripts? Sure, that will work!

Helmut Grohne helmut at subdivi.de
Thu Feb 6 09:56:22 UTC 2014


The following message is a courtesy copy of an article
that has been posted to gmane.linux.debian.devel.general as well.

Hi Pere,

On Wed, Feb 05, 2014 at 10:31:09PM +0100, Petter Reinholdtsen wrote:
> The idea is to let init.d scripts look like this:
> 
>   #!/lib/init/init-d-script
>   ### BEGIN INIT INFO
>   # Provides:          daemon
>   # Required-Start:    $remote_fs $syslog
>   # Required-Stop:     $remote_fs $syslog
>   # Default-Start:     2 3 4 5
>   # Default-Stop:      0 1 6
>   # Short-Description: nice daemon
>   # Description:       Provide service to others
>   ### END INIT INFO
>   DAEMON=/usr/sbin/daemond

This idea has been brought up a fair number of times now. While others
have already pointed out, that this is basically the approach taken by
OpenRC, we have a very similar implementation in the archive for far
longer. It's called upstart!

The relevant bits can be found in insserv, watch out for
"/lib/init/upstart-job". It takes things one step further though.
Instead of having an interpreted script, it right out replaces the init
script with a symbolic link to the mentioned helper. That in turn can
derive the job name from argv[0] and use the existing upstart job
description.

My attempt to reproduce such a utility for systemd have not worked out
unfortunately (for lack of time/interest).

So yeah, the approach taken is one that is known to be good. The main
downside I see with your particular implementation is that your answer
to the problem of too many standards is adding yet another one.

Why not write an upstart job instead? It works with sysvinit today!

Helmut





More information about the Pkg-sysvinit-devel mailing list