bundles/pppd: make sure dependent services are stopped before restarting pppoe session
This commit is contained in:
parent
7e4c69c3f1
commit
0aafeb96cd
5 changed files with 54 additions and 2 deletions
|
@ -7,8 +7,8 @@ Type=oneshot
|
||||||
RemainAfterExit=true
|
RemainAfterExit=true
|
||||||
ExecStart=/usr/bin/pon
|
ExecStart=/usr/bin/pon
|
||||||
ExecStop=/usr/bin/poff -a
|
ExecStop=/usr/bin/poff -a
|
||||||
# This is important, because otherwise systemd will kill the ip-down scripts!
|
ExecStop=/etc/ppp/wait-until-stopped
|
||||||
KillMode=none
|
TimeoutStopSec=90
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
WantedBy=default.target
|
WantedBy=default.target
|
||||||
|
|
17
bundles/pppd/files/wait-until-stopped
Normal file
17
bundles/pppd/files/wait-until-stopped
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
% for service in sorted(services):
|
||||||
|
(
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
if systemctl is-active ${service}
|
||||||
|
then
|
||||||
|
sleep 1
|
||||||
|
else
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
) &
|
||||||
|
% endfor
|
||||||
|
|
||||||
|
wait
|
|
@ -68,6 +68,13 @@ files = {
|
||||||
'svc_systemd:pppoe:restart',
|
'svc_systemd:pppoe:restart',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
'/etc/ppp/wait-until-stopped': {
|
||||||
|
'content_type': 'mako',
|
||||||
|
'context': {
|
||||||
|
'services': node.metadata.get('pppd', {}).get('wait-until-stopped', set()),
|
||||||
|
},
|
||||||
|
'mode': '0700',
|
||||||
|
},
|
||||||
'/etc/systemd/system/pppoe.service': {
|
'/etc/systemd/system/pppoe.service': {
|
||||||
'triggers': {
|
'triggers': {
|
||||||
'action:systemd-reload',
|
'action:systemd-reload',
|
||||||
|
|
|
@ -5,3 +5,17 @@ defaults = {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@metadata_reactor
|
||||||
|
def pppd(metadata):
|
||||||
|
if metadata.get('wide-dhcp6c/integrate-with-pppd', False):
|
||||||
|
return {
|
||||||
|
'pppd': {
|
||||||
|
'wait-until-stopped': {
|
||||||
|
'radvd.service',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {}
|
||||||
|
|
|
@ -16,3 +16,17 @@ defaults = {
|
||||||
'subnet_len': '8',
|
'subnet_len': '8',
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@metadata_reactor
|
||||||
|
def pppd(metadata):
|
||||||
|
if metadata.get('wide-dhcp6c/integrate-with-pppd', False):
|
||||||
|
return {
|
||||||
|
'pppd': {
|
||||||
|
'wait-until-stopped': {
|
||||||
|
'wide-dhcpv6-client.service',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {}
|
||||||
|
|
Loading…
Add table
Reference in a new issue