Created
January 11, 2014 01:34
-
-
Save AdamWhittingham/8365837 to your computer and use it in GitHub Desktop.
Teamspeak 3 init.d script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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