]> TLD Linux GIT Repositories - packages/openvpn.git/blob - openvpn.upstart
- from PLD
[packages/openvpn.git] / openvpn.upstart
1 description "Start the OpenVPN tunnels"
2
3 start on pld.network-started
4 stop on pld.network-stopped
5
6 task
7 console output
8
9 script
10         [ -f /etc/sysconfig/openvpn ] && . /etc/sysconfig/openvpn
11
12         for tun in $TUNNELS; do
13                 if [ ! -f "/etc/openvpn/$tun.conf" ]; then
14                         # skip invalid tunnels
15                         continue
16                 fi
17
18                 initctl start openvpn-tunnel TUNNEL=$tun >/dev/null || :
19         done
20 end script
21
22 pre-stop script
23         [ -f /etc/sysconfig/openvpn ] && . /etc/sysconfig/openvpn
24
25         for tun in $TUNNELS; do
26                 if [ ! -f "/etc/openvpn/$tun.conf" ]; then
27                         # skip invalid tunnels
28                         continue
29                 fi
30
31                 initctl stop openvpn-tunnel TUNNEL=$tun >/dev/null || :
32         done
33 end script