Hier mal mein Startscript für mein Teamspeak3 Server, ist sicher noch ausbaufähig! ;):
# By Maffert.net #!/bin/sh program=`basename $0` rc=0 # Script Einstellungen DIR=/home/ts3/teamspeak3-server_linux-amd64/ USER=ts3 BINARY=ts3server_linux_x64 # In den Teamspeak3 Ordner wechseln in dem die Installation liegt. cd $DIR || exit 1 case "$1" in start) echo -n "Starte Teamspeak3 Server ... " su -c './ts3server_startscript.sh stop' $USER >/dev/null 2>&1 & su -c './ts3server_startscript.sh start' $USER >/dev/null 2>&1 & echo $! ;; stop) echo "Stoppe Teamspeak3 Server ..." su -c './ts3server_startscript.sh stop' $USER ;; restart) $0 stop $0 start ;; *) echo usage: $0 '[start|stop|restart]' >[1=2] exit 1 ;; esac
Ansonsten gäbe es auch noch ein anderes Startscript:
#!/bin/bash
# Teamspeak3 Server Startscript - written by email@zeitsofa.de
# This is a small startscript for your teamspeak3 server
# This script was published under GPL ;)
# Have a lot of fun to edit and modify this script.
# Set up your own setting in configuration part of script below
### CONFIGURATION PART ###
# Daemon User - As which user TS3 should run?
DAEMON_USER="teamspeak"
# A little Description (Don't need to edit)
DESC="Teamspeak Server 3"
# Homedir from your TS3 (your TS3 root dir)
DIR=/home/teamspeak/ts3
# Which arch is your TS3? (x86 or amd64)
ARCH=x86
# TS3 bin file (Don't need to edit)
BIN=ts3server_linux_$ARCH
# Your pidfile
PID=tsserver3.pid
# Type your own parameters to start TS3 (last parameter have to by a &)
PARAMS="&"
## Below you down need to edit anything
DAEMON=$DIR/$BIN
PATH=$DIR:/bin:/usr/bin:/sbin:/usr/sbin
### MAIN PART ###
test -x $DAEMON || echo "Daemon not found in $DIR. Please check your BIN and DIR parts in $0"
case "$1" in
start)
echo "Start of $DESC"
if [ $(pidof $BIN) ]
then
echo "$DESC is running! Nothing to do!"
exit 1
else
cd $DIR
su $DAEMON_USER -c "$DAEMON $PARAMS" &> /dev/null
echo $(pidof $BIN) > $PID
echo "$DESC started successfully"
exit 0
fi
;;
stop)
echo "Stop $DESC"
if [ ! $(pidof $BIN) ]
then
echo "$DESC is not running! Nothing to do!"
exit 1
else
kill -TERM $(pidof $BIN)
echo "$DESC stopped successfully"
exit 0
fi
;;
restart)
$0 stop
sleep 1
$0 start
exit 0
;;
status)
echo "Running Process from $DESC:"
if [ ! $(pidof $BIN) ]
then
echo "===> no active process found!"
exit 0
else
ps -lC $BIN --no-heading
fi
;;
*)
echo "Parameter: $0 {start|stop|status|restart}"
exit 1
;;
esac