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

Henrique de Moraes Holschuh hmh at debian.org
Mon Feb 3 09:47:49 UTC 2014


On Sun, 02 Feb 2014, Petter Reinholdtsen wrote:
> I've also considered using functions that could be overriden in the
> init.d scripts.  The init-d-script could contain
> 
>   do_restart() {
>      ...
>   }
> 
> and the init.d script could contain a different implementation:
> 
>   do_restart() {
>      ... something else ...
>   }
> 
> The last definition would be used. :) But it would be hard to know if
> do_reload() exist and will do something sensible, so variables are
> perhaps a better approach.  Is there some way to figure out if a
> function exist, without calling it?

Either "command -V", "command -v", or the "type" builtins should do, I
suppose.  Both dash and bash support them.

Note that it is non-trivial to know that the name really is a function due
to aliases, etc.  There is a bashism for this, but dash doesn't support it.
I don't think this detail matters for our intended use, though.

-- 
  "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