[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Two line init.d scripts? Sure, that will work!

Petter Reinholdtsen <pere@hungry.com> writes:

> A few months ago I drafted an idea to rewrite init.d scripts to use a
> common implementation and only specify the unique parts in the init.d
> scripts themselves.  That draft can be found on
> <URL: http://people.skolelinux.org/pere/blog/Debian_init_d_boot_script_example_for_rsyslog.html >.

> The idea is to let init.d scripts look like this:

>   #!/lib/init/init-d-script
>   # 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
>   DAEMON=/usr/sbin/daemond

> Short and to the point, and in the simple case only list the path to the
> daemon to start.  The code to implement init.d scripts is moved to
> /lib/init/init-d-script, and the redundant code spread across
> /etc/init.d/ can be dropped.

It's probably worth mentioning that this is basically the path down which
OpenRC went, except that OpenRC has taken the concept somewhat further to
allow the dependencies to be specified in code instead of comments (using
special shell functions).  You may want to take a look at their syntax,
since it's extremely close to what you're doing but possibly a bit more
fleshed out.

Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>

Reply to: