1 |
On 3/5/19 6:03 AM, Alarig Le Lay wrote: |
2 |
> Okay, I tried to write another script: |
3 |
> https://git.grifon.fr/alarig/SwordArMor-gentoo-overlay/src/branch/master/net-misc/bird/files/initd-bird-2 |
4 |
> |
5 |
> I deleted things, but added others. I’m not sure if I respect all the |
6 |
> openrc standards as I’m not very comfortable with it. |
7 |
|
8 |
That's OK, it already looks a lot better. And it works, which is nice =) |
9 |
|
10 |
|
11 |
> |
12 |
> I added a check_run() function because I want to use the bird config |
13 |
> parser if it’s running. |
14 |
|
15 |
You probably want to specify the config file in check_run(). You might |
16 |
refactor the command_args as follows, |
17 |
|
18 |
client_args="-c ${CONF_FILE} -s ${SOCK}" |
19 |
command_args="${client_args} -P ${pidfile}" |
20 |
|
21 |
and then in check_run, you can use "birdc ${client_args}..." |
22 |
|
23 |
|
24 |
> |
25 |
> I added my own stop() function because bird has to wait for all the |
26 |
> sessions to be closed before killing the process. |
27 |
|
28 |
There's a "retry" variable that you can set at the top-level: |
29 |
|
30 |
retry Retry schedule to use when stopping the daemon. It can |
31 |
either be a timeout in seconds or multiple signal/time‐ |
32 |
out pairs (like SIGTERM/5). |
33 |
|
34 |
(from "man openrc-run") |
35 |
|
36 |
The default stop() function will use that, so you shouldn't need to |
37 |
write your own stop() if you set "retry=15". |
38 |
|
39 |
|
40 |
> |
41 |
> I’m open to your comments and improvements :) |
42 |
> |
43 |
|
44 |
The checkconfig() function isn't used any more, so it can be deleted. So |
45 |
long as bird crashes with an error like "no config file!" when the file |
46 |
is missing, I don't think you need to check for it yourself. |
47 |
|
48 |
These days /var/run is simply a symlink to /run, so those two paths can |
49 |
be shortened. |
50 |
|
51 |
Once you've used it for a while and are confident that everything works, |
52 |
please file a bug to include the improved script in the tree! |