#!/bin/sh
#
# Script for starting and stoping vtund.
#
# Writen by Dag Wieers <dag@life.be>. 
# Modified to use PID file by Maxim Krasnyansky <max_mk@yahoo.com>  
#
# chkconfig: 345 55 45
# description: vtund Virtual Tunnel Daemon.
#    VTun provides the method for creating Virtual Tunnels over TCP/IP networks
#    and allows to shape, compress, encrypt traffic in that tunnels.

# Source function library.
. /etc/rc.d/init.d/functions

# Read PID file
PID=`cat /var/run/vtund.pid`

# See how we were called.
case "$1" in
  start)
        echo -n "Starting vtund: "
        daemon /usr/sbin/vtund -s
        echo
        touch /var/lock/subsys/vtund
        ;;
  stop)
        echo -n "Stopping vtund: "
        kill $PID
        rm -f /var/lock/subsys/vtund
        echo "vtund"
        ;;
  restart)
        echo -n "Restarting vtund: "
	kill -HUP $PID
        echo "vtund"
        ;;
  status)
        status vtund
        ;;
  *)
        echo "Usage: vtund {start|stop|restart|status}"
        exit 1
esac

exit 0


