On 3/5/19 6:03 AM, Alarig Le Lay wrote:
> Okay, I tried to write another script:
> https://git.grifon.fr/alarig/SwordArMor-gentoo-overlay/src/branch/master/net-misc/bird/files/initd-bird-2
> 
> I deleted things, but added others. I’m not sure if I respect all the
> openrc standards as I’m not very comfortable with it.

That's OK, it already looks a lot better. And it works, which is nice =)


> 
> I added a check_run() function because I want to use the bird config
> parser if it’s running.

You probably want to specify the config file in check_run(). You might
refactor the command_args as follows,

  client_args="-c ${CONF_FILE} -s ${SOCK}"
  command_args="${client_args} -P ${pidfile}"

and then in check_run, you can use "birdc ${client_args}..."


> 
> I added my own stop() function because bird has to wait for all the
> sessions to be closed before killing the process.

There's a "retry" variable that you can set at the top-level:

  retry          Retry schedule to use when stopping the daemon. It can
                 either be a timeout in seconds or multiple signal/time‐
                 out pairs (like SIGTERM/5).

  (from "man openrc-run")

The default stop() function will use that, so you shouldn't need to
write your own stop() if you set "retry=15".


> 
> I’m open to your comments and improvements :)
> 

The checkconfig() function isn't used any more, so it can be deleted. So
long as bird crashes with an error like "no config file!" when the file
is missing, I don't think you need to check for it yourself.

These days /var/run is simply a symlink to /run, so those two paths can
be shortened.

Once you've used it for a while and are confident that everything works,
please file a bug to include the improved script in the tree!

Reply via email to