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 4 of 4
  1. #1
    Dennisen Guest

    Starting with Sudo doesn't work, have to start with root

    Hello,
    as you all know it's not recommended to start the Server as root, i want to start it as a user but i have so many programs and scripts that i do not have the time to login as user and then start the server, so i wrote a script that starts the Server with sudo. The Problem ist, that i cannot start the server like that because if i use the script i get the error message that the mysql library of TS cannot be found, if i start it with root it can be found and TS starts. What's the problem here. How do i manage to start the TeamSpeak-Server by a script using sudo, my script now looks like that, it starts as root, if i add the needed things to start it with sudo, i get the error that the mysqllibs cannot be found. Thanks for any help!

    Startscript can be found some posts below - NEW VERSION!
    Last edited by Dennisen; May 26th, 2011 at 12:33 PM.

  2. #2
    Dennisen Guest
    Please help me

  3. #3
    Join Date
    May 2010
    Posts
    6,310
    Hello

    Why make it simple when it can be complicated

    Just use this script line (e.g.):
    Code:
    su <user> -c "<path>/ts3server_startscript.sh start"

  4. #4
    Dennisen Guest
    Because i use my own startscript with all servers installed on my Root, i do not want to use default Startscripts, for severeal reasons. Other Solutions? I really need help here

    If i use sudo in my Startscript i get this Error:
    2011-05-26 05:51:53.144304|CRITICAL|DatabaseQuery | | unable to load database plugin library "libts3server_mysql.so", halting!

    If i use su in my Startscript i get this Error:
    2011-05-26 05:53:43.661472|INFO |DatabaseQuery | | dbPlugin name: MySQL plugin, (c)TeamSpeak Systems GmbH
    2011-05-26 05:53:43.661501|INFO |DatabaseQuery | | dbPlugin version: 1
    2011-05-26 05:53:43.663820|ERROR |DatabaseQuery | | mysql_real_connect() failed with error: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
    2011-05-26 05:53:43.663847|CRITICAL|ServerLibPriv | | Server() DatabaseError

    But the file exists! If i just start it as root, everything works fine. Why the hell can't i start it as a user from within a script? oO

    I made a new Startscript on base of screen. How do i manage to start the screen with sudo as another user without getting the error above?
    # !/bin/bash
    # Copyright (2011) by www.Allround-C.de

    export LD_LIBRARY_PATH=".:$LD_LIBRARY_PATH"

    case "$1" in

    start)
    cd /home/voice-server/teamspeak3/
    echo "============================================= ="
    echo "The TeamSpeak 3 Server is starting now."

    if [[ `screen -ls | grep 'teamspeak3'` ]]; then
    echo ">>> The TeamSpeak 3 Server is already started!"
    echo "============================================= ="
    exit 1
    fi

    screen -dmS teamspeak3 ./ts3server.so inifile=ts3server.ini

    echo "The TeamSpeak 3 Server was started now."
    echo "============================================= ="
    ;;

    stop)
    cd /home/voice-server/teamspeak3/
    echo "============================================= ="
    echo "The TeamSpeak 3 Server is stopping now."

    if [[ `screen -ls | grep 'teamspeak3'` ]]; then
    kill `screen -ls | grep 'teamspeak3' | awk -F . '{print $1}' | awk '{print $1}'`
    else
    echo ">>> The TeamSpeak 3 Server is already stopped!"
    echo "============================================= ="
    exit 1
    fi

    echo "The TeamSpeak 3 Server was stopped now."
    echo "============================================= ="
    ;;

    restart)
    $0 stop

    sleep 1
    echo ""
    echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~"
    echo ""
    sleep 1

    $0 start
    ;;

    status)
    cd /home/voice-server/teamspeak3/
    echo "============================================= ="

    if [[ `screen -ls | grep 'teamspeak3'` ]]; then
    echo ">>> The TeamSpeak 3 Server is started!"
    else
    echo ">>> The TeamSpeak 3 Server is stopped!"
    fi

    echo "============================================= ="
    ;;

    *)
    echo "Usage: $0 {start|stop|restart|status}"
    ;;

    esac
    exit 0
    Last edited by Dennisen; May 26th, 2011 at 12:32 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 8
    Last Post: March 9th, 2015, 10:58 PM
  2. Replies: 0
    Last Post: May 4th, 2011, 02:22 AM
  3. Replies: 1
    Last Post: April 7th, 2010, 03:34 PM

Posting Permissions

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