#!/bin/bash ### BEGIN INIT INFO # Provides: vpnserver # Required-Start: $network $syslog $remote_fs # Required-Stop: $network $syslog $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start firewall ### END INIT INFO # chkconfig: 2345 99 01 # description: SoftEther VPN Server DAEMON=/usr/local/vpnserver/vpnserver LOCK=/var/lock/vpnserver test -x $DAEMON || exit 0 case "$1" in start) $DAEMON start touch $LOCK TIMEOUTCOUNTER=0 MAXTIMEOUT=50 SLEEPINTERVAL=0.5 until ifconfig tap_soft 1>/dev/null 2>&1; do TIMEOUTCOUNTER=$((TIMEOUTCOUNTER + 1)) sleep $SLEEPINTERVAL if (( $TIMEOUTCOUNTER > $MAXTIMEOUT )); then echo "Time out waiting for device to come online. Could not add to bridge" 1>&2 exit 1 fi done brctl addif br0 tap_soft ;; stop) $DAEMON stop rm $LOCK ;; restart) $DAEMON stop sleep 3 $DAEMON start ;; *) echo "Usage: $0 {start|stop|restart}" exit 1 esac exit 0