Forum

Results 1 to 8 of 8
  1. #1
    Join Date
    October 2018
    Posts
    3

    Teamspeak server is running as root...

    Hello!
    I've installed ts3 server on my Ubuntu server but for some reason the service is running as root...
    I made a user, called teamspeak, installed teamspeak in the users /home.
    However when I do:
    service teamspeak start
    and then check with top, root is running that service, why?
    Note that I have done chown -R teamspeak:teamspeak /home/teamspeak

  2. #2
    Join Date
    April 2013
    Location
    Germany
    Posts
    73
    how do you start the teamspeak server?
    Do you have a file called teamspeak located in /etc/init.d ? if yes, can you share it with us?

  3. #3
    Join Date
    October 2018
    Posts
    3
    Quote Originally Posted by ZerefGG View Post
    how do you start the teamspeak server?
    Do you have a file called teamspeak located in /etc/init.d ? if yes, can you share it with us?
    I stat it with:
    Code:
    sudo service teamspeak start
    Sure, here is the 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=$(readlink -f "$0")
    BINARYPATH="$(dirname "${D1}")"
    cd "${BINARYPATH}"
    LIBRARYPATH="$(pwd)"
    BINARYNAME="ts3server"
    
    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"
                                    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
    EDIT (SOLVED):
    Fixed it by reinstalling and using the way of setting up the service mentioned on this site:
    https://www.vultr.com/docs/how-to-in...u-16-04-64-bit
    Last edited by jeppezon; December 1st, 2018 at 09:50 PM.

  4. #4
    Join Date
    December 2004
    Location
    RF
    Posts
    2,967

  5. #5
    Join Date
    April 2013
    Location
    Germany
    Posts
    73
    see the guide by ANR Daemon, or use this simple script:
    Code:
    #!/bin/sh
    ### BEGIN INIT INFO
    # Provides: 		Teamspeak 3 Server
    # Required-Start: 	$local_fs $network
    # Required-Stop:	$local_fs $network
    # Default-Start: 	2 3 4 5
    # Default-Stop: 	0 1 6
    # Description: 		Teamspeak 3 Server
    ### END INIT INFO
     
    
    
    USER="PUT_TEAMSPEAK_USER_HERE"
    DIR="/PATH/TO/TEAMSPEAK/FOLDER"
     
    ###### Teamspeak 3 server start/stop script ######
     
    case "$1" in
    start)
    su $USER -c "${DIR}/ts3server_startscript.sh start"
    ;;
    stop)
    su $USER -c "${DIR}/ts3server_startscript.sh stop"
    ;;
    restart)
    su $USER -c "${DIR}/ts3server_startscript.sh restart"
    ;;
    status)
    su $USER -c "${DIR}/ts3server_startscript.sh status"
    ;;
    *)
    echo "Usage: {start|stop|restart|status}" >&2
    exit 1
    ;;
    esac
    exit 0
    be sure you are in "/etc/init.d/"
    Code:
    chmod +x teamspeak
    Code:
    sudo update-rc.d teamspeak defaults

  6. #6
    Join Date
    December 2004
    Location
    RF
    Posts
    2,967
    Don't use init.d ffs.

  7. #7
    Join Date
    April 2013
    Location
    Germany
    Posts
    73
    Quote Originally Posted by ANR Daemon View Post
    Don't use init.d ffs.
    you have no idea what you are talking about.
    why systemd? can you tell me the pros and cons of both of them? ofc not

  8. #8
    Join Date
    December 2004
    Location
    RF
    Posts
    2,967
    init.d does not control the services it start.
    Whereas upstart and systemd do.

    init.d is dumb as a brick, it can't resolve dependencies and rely only on the order you gave to your scripts.

    There's a whole bunch of issues with init.d, that I can recite for hours.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [Suggestions] Block running on root/admin start
    By VJean in forum Suggestions and Feedback
    Replies: 10
    Last Post: August 24th, 2016, 07:12 PM
  2. Replies: 8
    Last Post: March 9th, 2015, 10:58 PM
  3. Replies: 0
    Last Post: May 4th, 2011, 02:22 AM
  4. can ts2 and ts3 server running on the same root?
    By ice76 in forum Server Support
    Replies: 3
    Last Post: December 22nd, 2009, 01:07 AM

Posting Permissions

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