1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 19:52:06 +00:00
iiab/roles/openvpn/templates/15-openvpn

35 lines
1.3 KiB
Text
Raw Normal View History

2017-05-27 18:09:50 +00:00
#!/bin/bash
2018-09-05 15:54:29 +00:00
# Not used as of August 2018: parent service "openvpn" reliably auto-starts child service "openpn@xscenet" on OS's in common use
2018-09-05 15:48:54 +00:00
# But could be revived for older CentOS etc?
2017-05-27 18:09:50 +00:00
export LC_ALL=C
#INTERFACE=$1 # The interface which is brought up or down
#STATUS=$2 # The new state of the interface
# whenever interface is brought up by NM (rhbz #565921)
if [ "$2" = "up" ]; then
# wait a few seconds to allow interface startup to complete
# (important at boot time without this the service still fails
# time-out for dispatcher script is 3s (rhbz#1003695#8)
sleep 2
/sbin/ip route list dev "$1" | grep -q '^default' &&
# restart the services
2018-09-05 16:07:30 +00:00
#systemctl -q is-enabled openvpn@xscenet.service && /usr/lib/iiab/up_wan
# EQUIVALENTLY:
systemctl is-enabled openvpn && pgrep openvpn && systemctl start openvpn@xscenet
2018-09-05 15:48:54 +00:00
# OR EQUIVALENTLY:
# systemctl is-enabled openvpn && systemctl is-active openvpn && systemctl start openvpn@xscenet
2017-05-27 18:09:50 +00:00
fi
# we added this to prevent logs from filling with openvpn errors
# but we do not expect openvpn to be on in that case
#if [ "$2" = "down" ]; then
# sleep 2
# /sbin/ip route list dev "$1" | grep -q '^default' ||
# stop the services
# systemctl -q is-enabled openvpn@xscenet.service && systemctl stop openvpn@xscenet.service
2017-05-27 18:09:50 +00:00
#fi
exit 0