Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement