SRCDS Steam group


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Linux/Unix]: TeamSpeak3 Init.d Script
#1
Based on my other SRCDS Init.d script here is one for Team Speak 3.
Same thing as my other one, avoiding root user and putting it into a detached "screen."

Code:
# replace <newuser> with the user you wish to run teamspeak 3 with.
USER="<newuser>"
# Do not change this path
PATH=/bin:/usr/bin:/sbin:/usr/sbin
# The path to the teamspeak 3 server/scripts . example = /home/teamspeak3/teamspeak3-server
DIR=<path>
DAEMON=$DIR/ts3server_minimal_runscript.sh
# Change all PARAMS to your needs. I required the ini so teamspeak used MySQL
PARAMS="inifile=ts3server.ini"
#Name = The screen will be named from this.
NAME=teamspeak3
DESC="Teamspeak Server 3"
case "$1" in
start)
echo "Starting $DESC"
su $USER -l -c "screen -m -d -S $NAME $DAEMON $PARAMS"
;;
stop)
su $USER -l -c "screen -S $NAME  -X quit "
    echo " ... done. $DESC Stopped."
;;
restart)
su $USER -l -c "screen -S $NAME  -X quit "
    echo " Closed Process, Restarting"
su $USER -l -c "screen -m -d -S $NAME $DAEMON $PARAMS"
echo " ... done. $DESC Restarted"
;;
status)
# Check whether there's a "Team Speak 3" process
ps aux | grep -v grep | grep ts3server_ > /dev/null
CHECK=$?
[ $CHECK -eq 0 ] && echo "$DESC is UP" || echo "$DESC is DOWN"
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
;;
esac
exit 0


On Ubuntu, add this script to your /etc/init.d directory. <script> = Scriptname e.g. Teamspeak3

Code:
sudo update-rc.d <script> defaults

To start the server:
Code:
/etc/init.d/<script> start

To stop the server:
Code:
/etc/init.d/<script> stop

To restart:
Code:
/etc/init.d/<script> restart

To check status:
Code:
/etc/init.d/<script> status
Which will reply either UP (online) or DOWN (offline.)


In Ubuntu you can also use:
Code:
service <script> restart

and the other start stop status commands.


Any feedback would be appreciated!
Check out http://resshef.co.cc for more stuff.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)