[Pkg-sysvinit-devel] Make init.d/skeleton a very simple init.d script?

Henrique de Moraes Holschuh hmh at debian.org
Sun Feb 2 19:48:48 UTC 2014

On Sun, 02 Feb 2014, Petter Reinholdtsen wrote:
> [Henrique de Moraes Holschuh]
> >> Do you believe we should move forward with this idea?  It would reduce
> > 
> > I like it, a lot.
> Thank you.  Please help polish it to get it releasable.  The
> problematic parts is 'reload/restart/forced-reload', as their
> behaviour differ quite a bit between daemons.  Some got 'reload'
> support, others need a complete restart.  I'm not quite sure how to
> best parameterise it. :)

Well, if we can leverage conditional shell parameter expansion, we could
have default behaviour and easily override it per-package in the "skeleton",
using constructs like ${variable:=default}, and ${variable:+word}.

It is available on dash and bash.

For example:
start-stop-daemon --stop --quiet \
   --retry=${TERM_SIG:=TERM}/${TERM_WAIT:=30}/KILL/5 --pidfile $PIDFILE \
   --name $NAME

Which will do the right thing if TERM_SIG or TERM_WAIT are unset.

And you can use it for functions, too.


will do exactly what you think: it will run either do_stop if STOPFUNC is
unset, or it will run the function/command in $STOPFUNC if it is set.

So, you can provide alternative functions (or subfunctions) to override the
default ones... as well as override any interesting parameters.

  "One disk to rule them all, One disk to find them. One disk to bring
  them all and in the darkness grind them. In the Land of Redmond
  where the shadows lie." -- The Silicon Valley Tarot
  Henrique Holschuh

More information about the Pkg-sysvinit-devel mailing list