Re: Re: Two line init.d scripts? Sure, that will work!
Petter Reinholdtsen <pere@hungry.com>:
>> Probably, we should have hooks, that can be invoked before specified
>> action (e.g. start or stop) and after. But not just for start/stop.
>
> I already got most of these hooks. Are more needed?
I think, for every action, mentioned in the LSB. But
that's a minor issue.
>> BTW, there is try-restart action, mentioned in the LSB. Probably,
>> you should add this. And you can implement some standard
>> do_reload function (with HUP signal), disabled by
>> default; the package maintainer can enable this with one-liner like
>> alias do_reload_override=standard_boilerplate_for_do_reload
>
> Good idea. Implemented.
I'm not sure if this is a right interface.
>> Also, a very common pattern is to specify some daemon
>> options somewhere in /etc/default/. Probably, it's a good
>> idea to include /etc/default/$YOUNAMEIT file and use
>> some variable (e.g. $OPTIONS) to provide additional
>> arguments to do_start_cmd/do_restart_cmd/do_reload_cmd.
>
> This can be done by the init.d script itself by simply sourcing that
> file. No need to do it in init-d-script.
Yes, but that's a *very* common pattern. Even for simple packages
(like monit) we must overload most of actions just for this reason.
So, I think it's reasonable to source /etc/defaults/ *or* to
use some specific shell variables to provide this flexibility.
>> You can add a specific helper to be invoked if a non-standard action
>> is specified. Only if that helper doesn't exist OR fail with status
>> code 3 - call usage(). Then exit with the provided status code (or
>> 3).
>
> Good idea. Implemented.
>
> Please check out the latest version.
Ah. In this case, we probably want to overload (or, better, to
extend?) do_usage() as well.
Reply to: