Ubuntu /etc/init.d/ventrilo startup script

Target Audience : Ubuntu Linux admin guru’s trying to install Ventrilo (i.e geeks)
Document : An example /etc/init.d ventrilo file

Well, it looks like having an automatically starting ventrilo server on Ubuntu isn’t as super easy as I’d hoped, unless I’m missing something stupidly wrong.
Thankfully I’ve already made an init.d file for a complied version of PureFTP (which I’ll post soon).

Firstly, go to the Ventrilo website, and download the server application, then upload it to your server. Some basic setup details are available here.

Let’s assume you’ve uploaded the ventrilo server file to the directory you are currently in.

Installing Ventrilo (assuming it was just uploaded to the server).

mkdir /usr/installed
mkdir /usr/installed/ventrilo
cd /usr/installed/ventrilo
gzip -d ventriloServer.tar.gz && tar -xf ventriloServer.tar
rm ventriloServer.tar ##Removes the zip file
touch /etc/init.d/ventrilo ##Create the startup script file
chmod ugo+x /etc/init.d/ventrilo ##Set file permissions
nano
/etc/init.d/ventrilo ## Write/configure the startup script. Note that you can use vi, or what ever editor you like

You can tweak the server settings by editing /usr/installed/ventrilo/ventrilo_srv.ini
You can manually test Ventrilo by running /usr/installed/ventrilo/ventrilo_srv

Now copy the custom Ventrilo startup script from below, tweak it as required (e.g if you installed to a different directory), and write it to /etc/init.d/ventrilo
File : /etc/init.d/ventrilo

#! /bin/sh
# Copyright (c) 2009 Michael Kubler
# All rights reserved.
#
# Author: Michael Kubler, 2009
#
# /etc/init.d/ventrilo

### BEGIN INIT INFO
# Provides:          Voip
# Required-Start:    $network
# Short-Description: Ventrilo daemon, Providing Ventrilo voice support
# Description:       The Ventrilo server provides a server for Ventrilo clients to connect to

### END INIT INFO

cd /usr/installed/ventrilo/
# /etc/init.d/ventrilo: start and stop the Ventrilo daemon

export PATH=”${PATH:+$PATH:}/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:”
VENT_BINARY=/usr/installed/ventrilo/ventrilo_srv
VENT_COMMANDS=”-d -f/usr/installed/ventrilo/ventrilo_srv”
PID_FILE=/usr/installed/ventrilo/ventrilo_srv.pid

## Set Colours (For a more interesting output)
BRIGHT_WHITE=”\033[1;37m”
WHITE=”\033[0;37m”
GREY=”\033[1;30m”
#RED=”\033[0;31m”
RED=”\033[1;31m”
BRIGHT_RED=”\033[1;31m”

# Check for missing binaries
test -x $VENT_BINARY || { echo “$VENT_BINARY not installed”;
if [ “$1” = “stop” ]; then exit 0;
else exit 6; fi; }

. /lib/lsb/init-functions ## A file that contains some useful functions, esp the logging stuff used in the script below.

case “$1” in
start)
log_begin_msg “Starting Ventrilo daemon : ”
echo -e “${WHITE}\c”
if [ -s $PID_FILE ] && kill -0 $(cat $PID_FILE) >/dev/null 2>&1; then
echo -e “${RED}WARNING : Ventrilo daemon already running. It will NOT be started.”
echo -e “${WHITE}Suggestion : Try using ‘/etc/init.d/ventrilo reload’ instead\033[;37m”
log_end_msg 1
exit 0
fi
start-stop-daemon –start –quiet –pidfile $PID_FILE –exec $VENT_BINARY — $VENT_COMMANDS
ES=$?
echo -e “${WHITE}\c”
log_end_msg $?

;;
stop)
echo -e “${BRIGHT_WHITE}\c” ##NB : The \c prevents a new line char
log_begin_msg “Stopping Ventrilo daemon : ”
echo -e “${RED}\c”
start-stop-daemon –stop –pidfile $PID_FILE
ES=$?
rm -f $PID_FILE
echo -e “${WHITE}\c”
log_end_msg $ES
;;
restart|reload|force-reload)
echo -e “${BRIGHT_WHITE}\c”
log_warning_msg “Stopping Ventrilo daemon : ”
echo -e “${RED}\c”
start-stop-daemon –stop –pidfile $PID_FILE
ES=$?
rm -f $PID_FILE
echo -e “${BRIGHT_WHITE}\c”
log_end_msg $ES
log_warning_msg “Starting Ventrilo daemon : ”
echo -e “${WHITE}\c”
if [ -s $PID_FILE ] && kill -0 $(cat $PID_FILE) >/dev/null 2>&1; then
echo “${RED}Ventrilo daemon already running according to $PID_FILE”
exit 0
fi
start-stop-daemon –start –quiet –pidfile $PID_FILE –exec $VENT_BINARY — $VENT_COMMANDS
ES=$?
log_end_msg $ES
echo -e “${WHITE}\c”
;;
*)
log_success_msg “Usage: /etc/init.d/ventrilo ${BRIGHT_WHITE}{start|stop|reload|force-reload|restart}${WHITE}”
exit 1
;;
esac
exit 0

You should now be able to start, stop, and reload ventrilo as you are used to with other apps.

e.g

/etc/init.d/ventrilo start
/etc/init.d/ventrilo stop
/etc/init.d/ventrilo restart

However it won’t automatically startup on boot. You have to run one last command to get that running.

update-rc.d ventrilo defaults

DONE!
You now have a Ventrilo server that you and your friends can connect to.

Please note : The free version of Ventrilo only allows for 8 people to connect, and their purchasing licensing is very restrictive (you have to purchase a minimum of 1000 slots). I’d suggest looking into Teamspeak, or Mumble instead.

Published by

Michael Kubler

Photographer, cinematographer, web master/coder.

One thought on “Ubuntu /etc/init.d/ventrilo startup script”

Leave a Reply

Your email address will not be published. Required fields are marked *