linamh/net-misc/openvpn-as/files/openvpnas.initd

44 lines
1.0 KiB
Plaintext
Raw Normal View History

#!/sbin/runscript
# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License, v2 or later
# $Header: /var/cvsroot/gentoo-x86/dev-vcs/subversion/files/svnserve.initd2,v 1.2 2012/01/14 19:46:34 tommy Exp $
depend() {
need net
}
target="/usr/local/openvpn_as/scripts/openvpnas"
pidfile="/var/run/openvpnas.pid"
sockfile="/usr/local/openvpn_as/etc/sock/sagent /usr/local/openvpn_as/etc/sock/sagent.localroot /usr/local/openvpn_as/etc/sock/sagent.api"
logfile="/var/log/openvpnas.log"
# remove daemon control socket
rm_sock()
{
for sf in $sockfile ; do
if [ -e "$sf" ]; then
rm -f "$sf" &>/dev/null
fi
done
}
# remove pidfile
rm_pidfile()
{
rm -f "$pidfile" &>/dev/null
}
start() {
rm_sock
rm_pidfile
ebegin "Starting OpenVPN Access Server"
start-stop-daemon --start --quiet --pidfile ${pidfile} --exec ${target} -- --logfile="$logfile" --pidfile="$pidfile"
eend $?
}
stop() {
ebegin "Stoping OpenVPN Access Server"
start-stop-daemon --stop --quiet --pidfile ${pidfile}
eend $?
}