Forum


Notice to all users

We are migrating towards a new forum system located at community.teamspeak.com, as such this forum will become read-only on January 29, 2020

Results 1 to 1 of 1
  1. #1
    Join Date
    July 2015
    Posts
    1

    Team speak as service in a Synology server

    Hello

    I have installed the ts3 in a synology server, the DS415play. It has a x86 architecture and it is compatible with linux version.

    It has been easy to install as a service but with problems.

    To install, I have done the the following steps:
    1. Download x86 version for linux
    2. Uncompress in a folder (/volume1/servers/ts3)
    3. Copy the script "ts3server_startscript.sh" in /usr/local/etc/rc.d/
    4. Modify the script: (1* see in the script file ) Set the path of the original binary

    When I execute this script (the result is the same that execute the original script "/volume1/servers/ts3/ts3server_startscript.sh") The console shows the following message: "TeamSpeak 3 server could not start" The origin of this message is marked in the file with "2*". However the server starts and the logs does not show error. The code error of the call ($?) is 1 but I don't know that mean. As there is an error, the pid is not saved. To "solve" it, I have added the line marked with 3* that saves the pid though there are errors. Which can be the error?

    My next version of the script, I'm going to replace these lines with the following sentences, It saves the pid if it exists:

    Code:
    "./${BINARYNAME}" ${COMMANDLINE_PARAMETERS} > /dev/null &
    PID=$!
    ps -p ${PID} > /dev/null 2>&1
    if [ "$?" -ne "0" ]; then
    	if [ "$PID" -ne "" ]; then
    		echo "TeamSpeak 3 server started but with errors. For details please view the log file"
    		echo $PID > ts3server.pid
    	else
    		echo "TeamSpeak 3 server could not start"
    	fi
    else
    	echo $PID > ts3server.pid
    	echo "TeamSpeak 3 server started, for details please view the log file"
    fi
    Script file:
    Code:
    #!/bin/sh
    # Copyright (c) 2010 TeamSpeak Systems GmbH
    # All rights reserved
    
    COMMANDLINE_PARAMETERS="${2}" #add any command line parameters you want to pass here
    D1=/volume1/servers/ts3/ts3server_startscript.sh # 1* The ts3 path
    BINARYPATH="$(dirname "${D1}")"
    cd "${BINARYPATH}"
    LIBRARYPATH="$(pwd)"
    
    
    if [ -e ts3server_linux_x86 ]; then
    	if [ -z "`uname | grep Linux`" -o ! -z "`uname -m | grep 64`" ]; then
                    echo "Do you have the right TS3 Server package for your system? You have: `uname` `uname -m`, not Linux i386."
            fi
            BINARYNAME="ts3server_linux_x86"
    elif [ -e ts3server_linux_amd64 ]; then
            if [ -z "`uname | grep Linux`" -o -z "`uname -m | grep 64`" ]; then
                    echo "Do you have the right TS3 Server package for your system? You have: `uname` `uname -m`, not Linux x86_64."
            fi
            BINARYNAME="ts3server_linux_amd64"
    elif [ -e ts3server_freebsd_x86 ]; then
            if [ -z "`uname | grep FreeBSD`" -o ! -z "`uname -m | grep 64`" ]; then
                    echo "Do you have the right TS3 Server package for your system? You have: `uname` `uname -m`, not FreeBSD i386."
            fi
            BINARYNAME="ts3server_freebsd_x86"
    elif [ -e ts3server_freebsd_amd64 ]; then
            if [ -z "`uname | grep FreeBSD`" -o -z "`uname -m | grep 64`" ]; then
                    echo "Do you have the right TS3 Server package for your system? You have: `uname` `uname -m`, not FreeBSD amd64."
            fi
            BINARYNAME="ts3server_freebsd_amd64"
    else
    	echo "Could not locate binary file, aborting"
    	exit 5
    fi
    
    case "$1" in
    	start)
    		if [ -e ts3server.pid ]; then
    			if ( kill -0 $(cat ts3server.pid) 2> /dev/null ); then
    				echo "The server is already running, try restart or stop"
    				exit 1
    			else
    				echo "ts3server.pid found, but no server running. Possibly your previously started server crashed"
    				echo "Please view the logfile for details."
    				rm ts3server.pid
    			fi
    		fi
    		if [ "${UID}" = "0" ]; then
    			echo WARNING ! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT
    			c=1
    			while [ "$c" -le 10 ]; do
    				echo -n "!"
    				sleep 1
    				c=$(($c+1))
    			done
    			echo "!"
    		fi
    		echo "Starting the TeamSpeak 3 server"
    		if [ -e "$BINARYNAME" ]; then
    			if [ ! -x "$BINARYNAME" ]; then
    				echo "${BINARYNAME} is not executable, trying to set it"
    				chmod u+x "${BINARYNAME}"
    			fi
    			if [ -x "$BINARYNAME" ]; then
    				export LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}"					
    				"./${BINARYNAME}" ${COMMANDLINE_PARAMETERS} > /dev/null &
     				PID=$!
    				ps -p ${PID} > /dev/null 2>&1
    				if [ "$?" -ne "0" ]; then
    					echo "TeamSpeak 3 server could not start" # 2*
    					echo $PID > ts3server.pid # 3*
    				else
    					echo $PID > ts3server.pid
    					echo "TeamSpeak 3 server started, for details please view the log file"
    				fi
    			else
    				echo "${BINARNAME} is not exectuable, cannot start TeamSpeak 3 server"
    			fi
    		else
    			echo "Could not find binary, aborting"
    			exit 5
    		fi
    	;;
    	stop)
    		if [ -e ts3server.pid ]; then
    			echo -n "Stopping the TeamSpeak 3 server"
    			if ( kill -TERM $(cat ts3server.pid) 2> /dev/null ); then
    				c=1
    				while [ "$c" -le 300 ]; do
    					if ( kill -0 $(cat ts3server.pid) 2> /dev/null ); then
    						echo -n "."
    						sleep 1
    					else
    						break
    					fi
    					c=$(($c+1)) 
    				done
    			fi
    			if ( kill -0 $(cat ts3server.pid) 2> /dev/null ); then
    				echo "Server is not shutting down cleanly - killing"
    				kill -KILL $(cat ts3server.pid)
    			else
    				echo "done"
    			fi
    			rm ts3server.pid
    		else
    			echo "No server running (ts3server.pid is missing)"
    			exit 7
    		fi
    	;;
    	restart)
    		$0 stop && $0 start ${COMMANDLINE_PARAMETERS} || exit 1
    	;;
    	status)
    		if [ -e ts3server.pid ]; then
    			if ( kill -0 $(cat ts3server.pid) 2> /dev/null ); then
    				echo "Server is running"
    			else
    				echo "Server seems to have died"
    			fi
    		else
    			echo "No server running (ts3server.pid is missing)"
    		fi
    	;;
    	*)
    		echo "Usage: ${0} {start|stop|restart|status}"
    		exit 2
    esac
    exit 0
    Thanks in advance

    PD: I have forgotten to say that The installation is via ssh and the user that install it is root
    Last edited by Yunxao; July 16th, 2015 at 09:15 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Team Speak Server 3
    By VATA Kenny in forum Windows
    Replies: 9
    Last Post: February 23rd, 2010, 08:59 PM
  2. How come the servers Team Speak 2 in Team Speak 3?
    By LuisPaiva in forum General Questions
    Replies: 1
    Last Post: December 28th, 2009, 09:05 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •