LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File ocserv.init of Package ocserv (Project home:aevseev)

#!/bin/bash
#
# chkconfig:    35 98 2
# description:  OpenConnect SSL VPN server
#
### BEGIN INIT INFO
# Provides:          ocserv
# Required-Start:    $syslog $network $remote_fs
# Required-Stop:     $syslog $network $remote_fs
# Default-Start:     3 5
# Default-Stop:      0 1 2 4 6
# Short-Description: OpenConnect SSL VPN server
# Description:       OpenConnect server (ocserv) is an SSL VPN server.
#	Its purpose is to be a secure, small, fast and configurable VPN server.
#	It implements the OpenConnect SSL VPN protocol, and has also (currently
#	experimental) compatibility with clients using the AnyConnect SSL VPN
#	protocol. The OpenConnect protocol provides a dual TCP/UDP VPN channel,
#	and uses the standard IETF security protocols to secure it.
### END INIT INFO

OCSERV_BIN=/usr/sbin/ocserv
OCSERV_PID=/var/run/ocserv.pid

if [ -r /etc/rc.status ]
then
  source /etc/rc.status
  START="/sbin/startproc"
  STATUS="/sbin/checkproc"
  SUCCESS="echo \$rc_done"
  FAILURE="echo \$rc_failed"
else
  source /etc/rc.d/init.d/functions
  START="daemon"
  STATUS="status"
  SUCCESS="success; echo"
  FAILURE="failure; echo"
fi

[ -r /etc/sysconfig/ocserv ] && source /etc/sysconfig/ocserv

RETVAL=0

case "$1" in
  start)
    echo -n "Starting ocserv: "
    ${START} ${OCSERV_BIN} --pid-file ${OCSERV_PID} --config ${OCSERV_CONFIG:-/etc/ocserv/ocserv.conf}
    RETVAL=$?
    ;;
  stop)
    echo -n "Stopping ocserv: "
    killproc -p ${OCSERV_PID} ${OCSERV_BIN}
    RETVAL=$?
    ;;
  restart)
    $0 stop
    $0 start
    unset RETVAL
    ;;
  reload)
    echo -n "Reloading configuration of ocserv: "
    killproc -p ${OCSERV_PID} -HUP ${OCSERV_BIN}
    RETVAL=$?
    ;;
  status)
    echo -n "Status of ocserv: "
    ${STATUS} ${OCSERV_BIN}
    RETVAL=$?
    ;;
  *)
    echo "Usage: $0 {start|stop|status|restart|reload}"
    exit 1
    ;;
esac
[ -z ${RETVAL} ] && exit
[ ${RETVAL} -eq 0 ] && eval "${SUCCESS}" || eval "${FAILURE}"
exit ${RETVAL}