Skip to content

Instantly share code, notes, and snippets.

@AdamWhittingham
Created January 11, 2014 01:34
Show Gist options
  • Save AdamWhittingham/8365837 to your computer and use it in GitHub Desktop.
Save AdamWhittingham/8365837 to your computer and use it in GitHub Desktop.
Teamspeak 3 init.d script
#!/bin/bash
#
# chkconfig: 2345 98 8
# description: start/stop/status the Teamspeak3 server
# On Ubuntu:
# - copy to `/etc/init.d/teamspeak3`
# - `sudo chmod +x /etc/init.d/teamspeak3`
# - `update-rc.d teamspeak3 defaults
# Set the following:
user=teamspeak
dir=/home/teamspeak/server/
# Check these in case you have some oddities
su=/bin/su
ts3=./ts3server_startscript.sh
case "$1" in
start)
$su - $user -c "cd $dir;$ts3 start"
;;
stop)
$su - $user -c "cd $dir;$ts3 stop"
;;
restart)
$su - $user -c "cd $dir;$ts3 restart"
;;
status)
$su - $user -c "cd $dir;$ts3 status"
;;
*)
echo $"Usage: $0 {start|stop|restart|status}"
exit 2
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment