1 |
Okay, I tried to write another script: |
2 |
https://git.grifon.fr/alarig/SwordArMor-gentoo-overlay/src/branch/master/net-misc/bird/files/initd-bird-2 |
3 |
|
4 |
I deleted things, but added others. I’m not sure if I respect all the |
5 |
openrc standards as I’m not very comfortable with it. |
6 |
|
7 |
I added a check_run() function because I want to use the bird config |
8 |
parser if it’s running. |
9 |
|
10 |
I added my own stop() function because bird has to wait for all the |
11 |
sessions to be closed before killing the process. |
12 |
|
13 |
I don’t know if I should make the configuration file and the sock file |
14 |
configurable with /etc/conf.d/bird |
15 |
|
16 |
I’m open to your comments and improvements :) |
17 |
|
18 |
|
19 |
My script behave like this: |
20 |
|
21 |
judicael-ovpn2 ~ # ps aux | grep bird |
22 |
root 3928 0.0 0.3 25752 7944 pts/1 S+ Mar04 0:04 vim /etc/init.d/bird |
23 |
root 5250 0.0 0.1 10860 2052 pts/3 S+ 11:31 0:00 grep --colour=auto bird |
24 |
judicael-ovpn2 ~ # rc-service bird start |
25 |
* Starting bird ... [ ok ] |
26 |
judicael-ovpn2 ~ # ps aux | grep bird |
27 |
root 3928 0.0 0.3 25752 7944 pts/1 S+ Mar04 0:04 vim /etc/init.d/bird |
28 |
root 5383 62.8 1.8 42184 37080 ? Rs 11:31 0:03 /usr/sbin/bird -c /etc/bird.conf -s /var/run/bird.ctl -P /var/run/bird.pid |
29 |
root 5400 0.0 0.1 10860 2236 pts/3 S+ 11:31 0:00 grep --colour=auto bird |
30 |
judicael-ovpn2 ~ # birdc 'sh pr' |
31 |
BIRD 2.0.4 ready. |
32 |
Name Proto Table State Since Info |
33 |
device1 Device --- up 11:31:26.782 |
34 |
direct1 Direct --- up 11:31:26.782 |
35 |
kernel_ipv4 Kernel master4 up 11:31:26.782 |
36 |
kernel_ipv6 Kernel master6 up 11:31:26.782 |
37 |
ibgp_nominoe_ipv4 BGP --- up 11:31:28.777 Established |
38 |
ibgp_nominoe_ipv6 BGP --- up 11:31:28.205 Established |
39 |
ibgp_budic_ipv4 BGP --- up 11:31:30.703 Established |
40 |
ibgp_budic_ipv6 BGP --- up 11:31:28.614 Established |
41 |
ospf_ipv4 OSPF master4 up 11:31:26.782 Running |
42 |
ospf_ipv6 OSPF master6 up 11:31:26.782 Running |
43 |
judicael-ovpn2 ~ # rc-service bird reload |
44 |
* Reloading BIRD ... [ ok ] |
45 |
judicael-ovpn2 ~ # rc-service bird restart |
46 |
* Stopping BIRD ... |
47 |
* Starting bird ... [ ok ] |
48 |
judicael-ovpn2 ~ # rc-service bird status |
49 |
* status: started |
50 |
|
51 |
|
52 |
So basically it works, and the error check as well: |
53 |
judicael-ovpn2 ~ # echo 'ezf' >> /etc/bird.conf |
54 |
judicael-ovpn2 ~ # rc-service bird reload |
55 |
* /etc/bird.conf:121:1 syntax error, unexpected SYM |
56 |
judicael-ovpn2 ~ # rc-service bird restart |
57 |
* Caching service dependencies ... [ ok ] |
58 |
* /etc/bird.conf:121:1 syntax error, unexpected SYM |
59 |
* ERROR: bird failed to stop |
60 |
judicael-ovpn2 ~ # sed -i '$d' /etc/bird.conf |
61 |
judicael-ovpn2 ~ # rc-service bird reload |
62 |
* Reloading BIRD ... [ ok ] |
63 |
|
64 |
-- |
65 |
Alarig |