#!/bin/sh

##
# OpenVPN-Server
##


. /etc/rc.common

StartService()
{
        	ConsoleMessage "Starting OpenVPN-Server"
                /usr/local/sbin/openvpn --daemon --cd /etc/openvpn \
			--config /etc/openvpn/server.conf \
			--writepid /var/run/openvpn.pid
}

StopService()
{
	pid=$(GetPID openvpn)   
	if [ $? = 0 ]; then
		ConsoleMessage "Stopping OpenVPN-Server"
		kill -TERM "${pid}"
	fi
}


RestartService () { StopService; StartService; }

RunService "$1"
