Commits

Kit Roed committed 85a34e2

Modified version of the ventrilo script made to run on Ubuntu. (2008-05-01)

Comments (0)

Files changed (1)

 #Ventrilo Script v2.1.0_02 written by Crypt Keeper
 #For ventrilo server v2.x
 
+## Updated by Kit Roed for use in Debian/Ubuntu init.d
+
 #Replace the values of VENPATH and VENSRV with your ventrilo path and server name. 
 #Replace the value of VENUSER with the account name that ventrilo runs under.
-VENPATH=/home/ventrilo
-VENSRV=$VENPATH/ventrilo_srv
-VENUSER=ventrilo
 
-if [ "$UID" -ne 0 ]
-then
-        echo "You must be root to run this script"
-        exit 64
-fi
+#PATH=/var/ventrilo
+VENPATH=/var/ventrilo
+VENPRG=ventrilo_srv
+VENSRV=$VENPATH/$VENPRG
+VENUSER=root
+
+#if [ "$UID" -ne 0 ]
+#then
+#        echo "You must be root to run this script"
+#        exit 64
+#fi
 
 check_pid ()
 {
-if [ -e $VENPATH/$1.pid ]
-then
-	PID=`cat $VENPATH/$1.pid`
-else
-	PID=0
-fi
+	if [ -e $VENSRV.pid ]
+	then
+		PID=`cat $VENPRG.pid`
+	else
+		PID=0
+	fi
 }
 
 start ()
 {
-echo ""
-su $VENUSER -c "$VENSRV -f$VENPATH/$1 -d"
-check_pid $1
-if [ $PID -ne 0 ]
-then
-	renice -20 $PID
-        echo ""
-        echo "Ventrilo server on Port:"$1" Started."
-        echo ""
-else
-        echo ""
-        echo "ERROR Ventrilo server on Port:"$1" Failed to Start"
-        echo ""
-        exit 66
-fi
+	echo ""
+	#su $VENUSER -c "$VENSRV -f$VENPATH/$1 -d"
+	#su root -c "/var/ventrilo/ventrilo_srv  -f/var/ventrilo/ventrilo_srv -d"
+	su $VENUSER -c "$VENSRV -f$VENSRV -d"
+
+	check_pid 
+	if [ $PID -ne 0 ]
+	then
+		renice -20 $PID
+	        echo ""
+	        echo "Ventrilo server Started."
+	        echo ""
+	else
+	        echo ""
+	        echo "ERROR Ventrilo server Failed to Start"
+	        echo ""
+	        exit 66
+	fi
 }
 
 stop ()
 {
-check_pid $1
-if [ $PID -ne 0 ]
-then
-        kill $PID
-        echo ""
-        echo "Ventrilo server on Port:"$1" with PID:"$PID" Stopped."
-        echo ""
-else
-        echo ""
-        echo "ERROR Ventrilo server on Port:"$1" Not Running."
-        echo ""
-        exit 67
-fi
+	check_pid 
+	if [ $PID -ne 0 ]
+	then
+	        kill $PID
+	        echo ""
+	        echo "Ventrilo server with PID:"$PID" Stopped."
+	        echo ""
+	else
+	        echo ""
+	        echo "ERROR Ventrilo server Not Running."
+	        echo ""
+	        exit 67
+	fi
 }
 
 noport ()
 {
-echo ""
-echo "Invalid argument string"
-echo "Please specify a port number"
-echo "-h|--help for usage"
-echo ""
-exit 68
+	echo ""
+	echo "Invalid argument string"
+	echo ""
+	echo "-h|--help for usage"
+	echo ""
+	exit 68
 }
 
 case $1 in
 -h|--help)
-        echo ""
-        echo "Ventrilo Script by Crypt Keeper"
-        echo "       start port#"
-        echo "       stop port#"
-        echo "       restart port#"
-	echo "       status port#"
-	echo ""
+        echo "Ventrilo Script"
+        echo " Usage: /etc/init.d/ventrilo {start|stop|restart|status}"
         ;;
 start)
-        if [ $# -eq 2 ]
-        then
-		start $2
-	else
-        	noport
-        fi
+	start
         ;;
 stop)
-        if [ $# -eq 2 ]
-        then
-		stop $2
-	else
-        	noport
-        fi
+	stop
         ;;
 restart)
-        if [ $# -eq 2 ]
-        then
-		stop $2
-		start $2
-	else
-		noport
-        fi
+	stop
+	start
 	;;
 status)
-        if [ $# -eq 2 ]
-        then
-		check_pid $2
-		if [ $PID -ne 0 ]
-		then
-			echo ""		
-			echo "Ventrilo server on Port:"$2" -Running- with PID:"$PID
-			echo ""
-		else
-			echo ""
-			echo "Ventrilo server on Port:"$2" -Not Running-"
-			echo ""
-		fi
-        else
-                noport
-        fi
+	check_pid 
+	if [ $PID -ne 0 ]
+	then
+		echo ""		
+		echo "Ventrilo server on  -Running- with PID:"$PID
+		echo ""
+	else
+		echo ""
+		echo "Ventrilo server -Not Running-"
+		echo ""
+	fi
         ;;
 
 * )