summaryrefslogtreecommitdiffstats
path: root/testing/quicktun/quicktun.initd
blob: 0ea49557ec1b793f76df86d47afc214d103d1d48 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/sbin/runscript

VPN=${SVCNAME#*.}
if [ ${SVCNAME} != "quicktun" ]; then
  pidfile="/var/run/quicktun.${VPN}.pid"
else
  pidfile="/var/run/quicktun.pid"
fi

command=/usr/bin/quicktun

start() {
  if [ -e "/etc/quicktun/${VPN}.conf" ]
  then
    source "/etc/quicktun/${VPN}.conf"
  else
    eerror "Config /etc/quicktun/${VPN}.conf not found"
    exit 1
  fi

  ebegin "Starting ${SVCNAME}"
  start-stop-daemon --start --exec ${command} --pidfile ${pidfile} \
    --background --make-pidfile
  eend $?
}