Community Forums Today's Posts     Member List     Archive    
Page 3 of 3 FirstFirst 123
Results 31 to 45 of 45
  1. #31
    Join Date
    Feb 2005
    Location
    Knox-vegas
    Posts
    10

    Linux Init Script for TS

    This is an init script I wrote for my clans server. It is setup to allow running multiple host instances as well. It works on CentOS3.3. Can not claim it will work on any others, but I see no reason it will not. I took bits and peices from a lot of places to get this working. I hope it saves someone a few hours of thier time.

    Code:
    #!/bin/bash
    #
    # teamspeak        Starts Teamspeak server.
    #
    #	Date: 9/24/2005
    #   Author: [BBF]Jester
    #	Note: I do not and will not provide support for this script.  It is as-is and with out any warranty what so ever.
    #   It is also source material from various scripts found on this site.  
    #   Magic Power, HomeBrew, and others I am sure.  I unfortunatly did not keep track of who I was taking my bits and peices from.
    #   I appologize to those that I missed.
    #
    # description: Teamspeak is a quality, scalable application which \
    # enables people to speak with one another over the Internet.
    #
    #Create a user on the server.
    #Copy the TS install to a common location. (eg /usr/share/tss2_rc2)
    #Enter the username you just created below and adjust the tsserver var to be where you copied TS to.
    # Copy this script to your init.d folder.  chmod it to 755 and run
    # Add the symlinks in the rc.x folders.  I did 0,1,2,6 at 11 and 3,4,5 at 91.  
    # This script was written for CentOS3.3.  I see no reason why it would not work on all systems with init.d systems.
    
    # Source function library.
    . /etc/init.d/functions
    
    #config
    tsuser=<enter TS username here>
    tsserver=/usr/share/tss2_rc2/server_linux
    rundir=/home/$tsuser/ts
    
    piddir=$rundir
    pidname=$tsuser.pid
    
    logdir=/var/log
    logname=$tsuser.log
    
    dbdir=$rundir
    dbname=server.dbs
    
    inidir=$rundir
    ininame=server.ini
    
    badnamesdir=$rundir
    badnamesname=bad_names.txt
    
    
    tsstart() {
            echo -n "Starting $tsuser TeamSpeak server:"
            if [ -e "$piddir/$pidname" ]; then
                    echo -n "$pidname already exists...Is the server already running?";
                    echo -n "If you are sure the server is not running, delete $piddir/$pidname"
                    exit 1
            else
                    if [ -e "$tsserver" ]; then
                            sudo -u $tsuser  $tsserver -PID=$piddir/$pidname -log=$logdir/$logname -db=$dbdir/$dbname -ini=$inidir/$ininame -badnames=$badnamesdir/$badnamesname &> /dev/null
                    else
                            echo -n "Couldn't find $tsserver"
                            exit 5
                    fi
            fi
            RETVAL=$?
            [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$tsuser && success || failure
            echo
            return $RETVAL
    }
    
    tsstop(){
            if [ -e "$piddir/$pidname" ]; then
                    echo -n "Stopping $tsuser TeamSpeak server."
                            if ( kill -TERM `cat $piddir/$pidname` ); then
                                    for c in $(seq 1 300); do
                                            if [ -e "$piddir/$pidname" ]; then
                                                    echo -n "."
                                                    sleep 1
                                            fi
                                    done
                            fi
                            if [ -e "$piddir/$pidname" ]; then
                                    echo -n "The server does not shutdown properly - killing stray processes."
                                    kill -KILL `cat $piddir/%pidname`
                                    rm $piddir/$pidname
                                    sleep 5
                            else
                                    echo -n "done"
                            fi
                    else
                    echo -n "$pidname is missing. There is no server to stop."
                    exit 7
            fi
            RETVAL=$?
            [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$tsuser && success || failure
            echo
            return $RETVAL
    }
    
    tsrestart() {
            tsstop
            tsstart
    }
    
    tsstatus() {
            if [ -e "$piddir/$pidname" ]; then
                    printf "The server seems to be running. \n"
                    exit 0
            else
                    printf "The server seems to be stopped. \n"
                    exit 3
            fi
    }
    
    case "$1" in
            start)
                    tsstart
            ;;
            stop)
                    tsstop
            ;;
            restart|reload)
                    tsrestart
            ;;
            status)
                    tsstatus
            ;;
            *)
            echo $"Usage: $0 {start|stop|restart|status}"
            exit 1
    esac

  2. #32
    Join Date
    Jan 2006
    Location
    PA, US
    Posts
    4
    Quote Originally Posted by [BBF]Jester
    This is an init script I wrote for my clans server. It is setup to allow running multiple host instances as well. It works on CentOS3.3. Can not claim it will work on any others, but I see no reason it will not. I took bits and peices from a lot of places to get this working. I hope it saves someone a few hours of thier time.

    thanks jester! I didn't get a chance to try this yet, but this is exactly what i've been searching for.

  3. #33
    Join Date
    Jan 2006
    Location
    PA, US
    Posts
    4

    edited the script

    I have edited Jester's script for my own use, and figured someone else might want to use it or modify it to make it even better

    First of all, I used the tutorial created here: http://forum.goteamspeak.com/showthread.php?t=15438

    I only have 1 user that was created simply to start this server, and that is it. Secondly, the only reason i modified the script in the first place was because Jester's script worked fine, as long as the server never crashed. If the TS server had been killed not using the script, it would not start on bootup. Therefore, the only real editing I did was to hvae it check the output of 'ps aux' (using Fedora Core 4 as my OS; other linux OS's sometimes use ps -ef) to make sure that the process wasn't actually running.

    That said, here it is for anyone who wants to use it, modify it, laugh at it, etc.

    Code:
    #!/bin/bash
    #
    # teamspeak        Starts Teamspeak server.
    #
    #       Date: 9/24/2005
    #   Author: [BBF]Jester
    #       Note: I do not and will not provide support for this script.  It is as-is and with out any warranty what so ever.
    #   It is also source material from various scripts found on this site.
    #   Magic Power, HomeBrew, and others I am sure.  I unfortunatly did not keep track of who I was taking my bits and peices from.
    #   I appologize to those that I missed.
    #
    # description: Teamspeak is a quality, scalable application which \
    # enables people to speak with one another over the Internet.
    #
    #Create a user on the server.
    #Copy the TS install to a common location. (eg /usr/share/tss2_rc2)
    #Enter the username you just created below and adjust the tsserver var to be where you copied TS to.
    # Copy this script to your init.d folder.  chmod it to 755 and run
    # Add the symlinks in the rc.x folders.  I did 0,1,2,6 at 11 and 3,4,5 at 91.
    # This script was written for CentOS3.3.  I see no reason why it would not work on all systems with init.d systems.
    
    # Source function library.
    . /etc/init.d/functions
    
    #config
    tsuser=!!!!!!!!!!!<user goes here>!!!!!!!!!!
    tsexec=server_linux
    rundir=/home/$tsuser/tss2_rc2
    tsserver=$rundir/$tsexec
    
    piddir=$rundir
    pidname=$tsuser.pid
    
    logdir=/var/log
    logname=$tsuser.log
    
    dbdir=$rundir
    dbname=server.dbs
    
    inidir=$rundir
    ininame=server.ini
    
    badnamesdir=$rundir
    badnamesname=bad_names.txt
    
    tsprocs=`ps aux | grep "$tsexec" | grep -v "grep" | awk -F" " '{ print $2 }'`
    if [ -e "$piddir/pidname" ]; then
            tspid=`cat $piddir/$pidname`
    else
            tspid="0"
    fi
    
    tsstart() {
            echo -n "Starting TeamSpeak server:"
    #       If $tsexec shows up as running more than once, find the real pid (which should be the first in the list)
            for procid in $tsprocs
            do
                    if [ "$procid" -eq "$tspid" ]; then
                            tsproc=$procid
                            break
                    fi
            done
            if [ -n "$tsproc" ] && [ $tsproc != "" ] && [ "$tsproc" -eq "$tspid" ]; then
                    echo -n "Process is running with pid $tsproc, exiting script..."
                    exit 1
            fi
            if [ -e "$piddir/$pidname" ]; then
                    echo -n "$pidname exists, but server not running. Deleting $piddir/$pidname and starting server..."
                    rm -f $piddir/$pidname
            fi
            if [ -e "$tsserver" ]; then
                    sudo -u $tsuser  $tsserver -PID=$piddir/$pidname -log=$logdir/$logname -db=$dbdir/$dbname -ini=$inidir/$ininame -badnames=$badnamesdir/$badnamesname &> /dev/null
            else
                    echo -n "Couldn't find $tsserver"
                    exit 5
            fi
            RETVAL=$?
            [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$tsuser && success || failure
            echo
            return $RETVAL
    }
    
    tsstop(){
            if [ -e "$piddir/$pidname" ]; then
                    echo -n "Stopping $tsuser TeamSpeak server."
                            if ( kill -TERM `cat $piddir/$pidname` ); then
                                    for c in $(seq 1 300); do
                                            if [ -e "$piddir/$pidname" ]; then
                                                    echo -n "."
                                                    sleep 1
                                            fi
                                    done
                            fi
                            if [ -e "$piddir/$pidname" ]; then
                                    echo -n "The server does not shutdown properly - killing stray processes."
                                    kill -KILL `cat $piddir/%pidname`
                                    rm $piddir/$pidname
                                    sleep 5
                            else
                                    echo -n "done"
                            fi
                    else
                    echo -n "$pidname is missing. There is no server to stop."
                    exit 7
            fi
            RETVAL=$?
            [ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$tsuser && success || failure
            echo
            return $RETVAL
    }
    
    tsrestart() {
            tsstop
            tsstart
    }
    
    tsstatus() {
            if [ -e "$piddir/$pidname" ]; then
                    printf "The server seems to be running. \n"
                    exit 0
            else
                    printf "The server seems to be stopped. \n"
                    exit 3
            fi
    }
    
    case "$1" in
            start)
                    tsstart
            ;;
            stop)
                    tsstop
            ;;
            restart|reload)
                    tsrestart
            ;;
            status)
                    tsstatus
            ;;
            *)
            echo $"Usage: $0 {start|stop|restart|status}"
            exit 1
    esac

  4. #34
    Join Date
    Feb 2006
    Location
    France
    Posts
    19
    hello
    I have read the tuto and I have a problem with my server.
    he don't want to start
    the Konsole says this when I start it

    starting the teamspeak2 server
    Error, Either an old instance of teamspeak is still running, or
    an other application is using the tcpquery port!
    Error, Server was not started!

    I have madriva
    What I must do ?
    I don't understand because i dont have other ap who are run ....
    pls help me
    by
    scaraber

  5. #35
    Join Date
    Jul 2003
    Location
    near Atlanta, GA, USA
    Posts
    7
    scaraber,

    The reason the server isn't starting is that the PID file is still out there.

    The script that starts the server tells it write a PID file (tsserver.pid) to indicate that it is running and to help the script stop the server later. Whenever you start the server, the script first checks to be sure that it isn't already running by checking for the PID file. If the script finds the PID file, it asssumes that the server is running and won't start it.

    The script deletes the PID file when you stop the server so that you can later re-start it again. This works well most of the time, but sometimes the server stops under irregular circumstances, like power outages. When this happens, the PID file does not get deleted. The resolution to this is the delete the PID (tsserver.pid) file yourself.

    To address the power outage scenario, I added a line at the bottom of my rc.sysinit script to check for the PID file and delete it during the boot process.

    Now, I just need to figure out how to get SELinux to play nicely with the su command I use to launch the server in my start script...

  6. #36
    Join Date
    Feb 2006
    Location
    France
    Posts
    19
    thx for your awnser.
    but I don't have understand all I have linux for 2 two days only.
    I have ann question what server I must be use the binary or the other because I dont have the same file of the tutorial..


    bad_names.txt INSTALL Manual README server_linux sqlite_sql
    changelog.txt INSTALL.mysql manual.html server.dbs server.log tcpquerydocs
    httpdocs libsqlmy.so mysql_sql server.ini sqlite.so teamspeak2-server_startscript


    edit
    It is ok the server start I don't know why he dont wnat yesterday....

    by
    scaraber

  7. #37
    Join Date
    Feb 2008
    Location
    minnesota
    Posts
    2
    this was done on ubuntu server edition 7.04 also worked on 7.10 just follow the links directions, and i was all the way updated at the time!
    http://yago.csgamestats.com/yago/ubu...er%20linux.txt
    Last edited by yago_potato; 02-03-2008 at 10:11. Reason: not sure if my code is perfect

  8. #38
    Join Date
    Feb 2008
    Location
    minnesota
    Posts
    2
    i would like to know if this works for other people also!

  9. #39
    Join Date
    Mar 2008
    Location
    BRD
    Posts
    2
    I tried to use berky2755's script on my ubuntu dapper system but it didn't work. There were some minor errors due to the different distribution.

    First of all, ubuntu doesn't know the 'Source function library'. Second, the following lines contained unknown commands:
    Code:
            RETVAL=$?
            [ $RETVAL -eq 0 ] && touch /var/lock/subsys/$tsuser && success || failure
            echo
            return $RETVAL
    Both errors could be solved by removing that lines.

    I installed tss to /usr/shared/tss2_rc2 and created a user tss for running tss. Feel free change..

    Finally here's my version of /etc/init.d/tss
    Code:
    #!/bin/bash
    #
    # teamspeak        Starts Teamspeak server.
    #
    #       Date: 03/12/2008
    #   Author: [BBF]Jester, berky2755, kdw's
    #       Note: I do not and will not provide support for this script.  It is as-is and with out any warranty what so ever.
    #   It is also source material from various scripts found on this site.
    #   Magic Power, HomeBrew, and others I am sure.  I unfortunatly did not keep track of who I was taking my bits and peices f$
    #   I appologize to those that I missed.
    #
    # description: Teamspeak is a quality, scalable application which \
    # enables people to speak with one another over the Internet.
    #
    #Create a user on the server.
    #Copy the TS install to a common location. (eg /usr/share/tss2_rc2)
    #Enter the username you just created below and adjust the tsserver var to be where you copied TS to.
    # Copy this script to your init.d folder.  chmod it to 755 and run
    # Add the symlinks in the rc.x folders.  I did 0,1,2,6 at 11 and 3,4,5 at 91.
    # This script was written for CentOS3.3.  I see no reason why it would not work on all systems with init.d systems.
    
    
    #config
    tsuser=tss
    tsexec=server_linux
    rundir=/usr/share/tss2_rc2
    tsserver=$rundir/$tsexec
    
    piddir=$rundir
    pidname=$tsuser.pid
    
    logdir=/var/log
    logname=$tsuser.log
    
    dbdir=$rundir
    dbname=server.dbs
    
    inidir=$rundir
    ininame=server.ini
    
    badnamesdir=$rundir
    badnamesname=bad_names.txt
    
    tsprocs=`ps aux | grep "$tsexec" | grep -v "grep" | awk -F" " '{ print $2 }'`
    if [ -e "$piddir/pidname" ]; then
            tspid=`cat $piddir/$pidname`
    else
            tspid="0"
    fi
    
    tsstart() {
            echo -n "Starting TeamSpeak server:"
    #       If $tsexec shows up as running more than once, find the real pid (which should be the first in the list)
            for procid in $tsprocs
            do
                    if [ "$procid" -eq "$tspid" ]; then
                            tsproc=$procid
                            break
                    fi
            done
            if [ -n "$tsproc" ] && [ $tsproc != "" ] && [ "$tsproc" -eq "$tspid" ]; then
                    echo -n "Process is running with pid $tsproc, exiting script..."
                    exit 1
            fi
            if [ -e "$piddir/$pidname" ]; then
                    echo -n "$pidname exists, but server not running. Deleting $piddir/$pidname and starting server..."
                    rm -f $piddir/$pidname
            fi
            if [ -e "$tsserver" ]; then
                    sudo -u $tsuser  $tsserver -PID=$piddir/$pidname -log=$logdir/$logname -db=$dbdir/$dbname -ini=$inidir/$inin$
                    echo " Done."
            else
                    echo -n "Couldn't find $tsserver"
                    exit 5
            fi
            echo
    }
    
    tsstop(){
            if [ -e "$piddir/$pidname" ]; then
                    echo -n "Stopping $tsuser TeamSpeak server."
                            if ( kill -TERM `cat $piddir/$pidname` ); then
                                    for c in $(seq 1 300); do
                                            if [ -e "$piddir/$pidname" ]; then
                                                    echo -n "."
                                                    sleep 1
                                            fi
                                    done
                            fi
                            if [ -e "$piddir/$pidname" ]; then
                                    echo -n "The server does not shutdown properly - killing stray processes."
                                    kill -KILL `cat $piddir/%pidname`
                                    rm $piddir/$pidname
                                    sleep 5
                            else
                                    echo -n "done"
                            fi
                    else
                    echo -n "$pidname is missing. There is no server to stop."
                    exit 7
            fi
            echo
            echo
    }
    
    tsrestart() {
            tsstop
            tsstart
    }
    
    tsstatus() {
            if [ -e "$piddir/$pidname" ]; then
                    printf "The server seems to be running. \n"
                    exit 0
            else
                    printf "The server seems to be stopped. \n"
                    exit 3
            fi
    }
    
    case "$1" in
    
            start)
                    tsstart
            ;;
            stop)
                    tsstop
            ;;
            restart|reload)
                    tsrestart
            ;;
            status)
                    tsstatus
            ;;
            *)
            echo $"Usage: $0 {start|stop|restart|status}"
            exit 1
    esac
    Last edited by kdws; 12-03-2008 at 16:31.

  10. #40
    Join Date
    Mar 2008
    Location
    BRD
    Posts
    2
    I finally did some more edits to get the typical ubuntu start-script output

    here it is..
    Attached Files Attached Files

  11. #41
    Join Date
    Jan 2003
    Location
    The Netherlands
    Posts
    1,424
    kdw, would this work in CentOs also? Im using version 5.x
    Looking for somethign like this so the server gets booted automaticly..

  12. #42
    Join Date
    Mar 2008
    Location
    Mendocino
    Posts
    10
    Quote Originally Posted by PureGrain View Post
    TeamSpeak Linux Server Tutorial v2.0 by PureGrain

    Finally I have decided to update this quite old tutorial. I hope this new version will help out even more than the old one did. I have been quite and did not mean to wait so long for this, so now it is here. Thanks to all of those who have given me credit and given my tutorial a look over. There may be an easier way or a fast way or even another way to do what I have listed, but this wayworks for me.

    Enjoy!!



    *EDIT*
    New flash version coming soon.
    It's not a good link anymore. Ad site.

  13. #43
    Join Date
    Jan 2009
    Location
    Turkey
    Posts
    1
    Hi all. I registered domain and hosting. I have a host on Linux Server. But did'nt install Teamspeak 2 Server Linux. Help me please.

    My messenger adress: jurkozbek***********

    Thank you...

  14. #44
    Join Date
    Jun 2009
    Location
    France, Lyon
    Posts
    1

    Lightbulb Important

    For all ubuntu user who want to install TS :

    Code:
    sudo apt-get install teamspeak-server
    default password here : /etc/teamspeak-server/passwords
    server.ini : /etc/teamspeak-server/server.ini

    Code:
    sudo /etc/init.d/teamspeak-server
    Usage: /etc/init.d/teamspeak-server {start|stop|status|restart|force-reload}

  15. #45
    Join Date
    May 2011
    Posts
    1
    made it sticky and removed some bumps




    Microsoft Office 2010Microsoft Office Professional Plus 2010

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. ts2 server fr lan und www gleichzeitig
    By porki in forum [TeamSpeak 2] Server Support
    Replies: 4
    Last Post: 13-06-2005, 19:47
  2. TS2 Server on client/network, lan, XP????
    By Lomez in forum [TeamSpeak 2] Server Support
    Replies: 2
    Last Post: 17-09-2002, 17:45
  3. Scheisse habe QDSL alles geht nur keine REG
    By Creeper in forum [TeamSpeak 2] Server Support
    Replies: 6
    Last Post: 29-08-2002, 10:06

Posting Permissions

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