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 3 of 3
  1. #1
    Join Date
    December 2009
    Location
    Germany
    Posts
    2

    [outdated] Init Script (Modified the old TS2 Server Script)

    Edit by mod
    Please don't use this outdated script anymore! The script got an overhaul long time ago.
    Please use the minimal or startscript instead


    #! /bin/bash
    # ##################
    # Initscript updated for Teamspeak3 2009-12-20
    # ##################
    #
    # Teamspeak2 Init script Copyright (c) 2004 TeamSpeak team All rights reserved.
    #
    # Author: pwk.linuxfan 2004
    #

    ###########################
    # SETTINGS
    ###########################

    # Make sure the folder and all files belong to the user!
    # Furthermore the token in /dev/shm/ shall be accessible by the user below.

    USER=teamspeak3
    DIR=/opt/teamspeak3
    BINARY=ts3server_linux_x86

    #BINARY=ts3server_linux_amd64

    ###########################
    # END SETTINGS
    ###########################

    cd $DIR

    case "$1" in
    start)
    if [ "" != "`ps aux | grep $BINARY | grep -v grep | awk '{print $2}'`" ]; then
    echo "The Teamspeak3 Server seems to be already running... ?";
    exit 1
    else
    if [ "$USER" = "root" ]; then
    echo WARNING ! For security reasons we advise: DO NOT RUN THE SERVER AS ROOT
    for c in $(seq 1 10); do
    echo -n "!"
    sleep 1
    done
    echo !
    fi
    echo "starting the teamspeak3 server"
    if [ -e $BINARY ]; then
    if [ ! -x $BINARY ]; then
    echo "$BINARY is not executable, trying to set it"
    chmod u+x $BINARY
    fi
    if [ -x $BINARY ]; then
    su -c "cd $DIR && $DIR/$BINARY" - $USER &>/dev/null &
    else
    echo "$BINARY is not executable, fix this"
    exit 4
    fi
    else
    echo "Couldnt find $BINARY"
    exit 5
    fi
    fi
    ;;
    stop)
    if [ "" != "`ps aux | grep $BINARY | grep -v grep | awk '{print $2}'`" ]; then
    echo -n "stopping the teamspeak3 server"
    if ( kill -TERM `ps aux | grep $BINARY | grep -v grep | awk '{print $2}'` ); then
    #echo "Killing Teamspeak"
    for c in $(seq 1 300); do
    if [ "" != "`ps aux | grep $BINARY | grep -v grep | awk '{print $2}'`" ]; then
    echo -n "."
    sleep 1
    fi
    done
    fi
    if [ "" != "`ps aux | grep $BINARY | grep -v grep | awk '{print $2}'`" ]; then
    echo "server does not shutdown cleanly - killing"
    kill -KILL "`ps aux | grep $BINARY | grep -v grep | awk '{print $2}'`"
    sleep 5
    else
    echo "done"
    fi
    else
    echo "could not find running server ?"
    exit 7
    fi
    ;;
    restart)
    $0 stop && $0 start || exit 1
    ;;
    status)
    if [ "" != "`ps aux | grep $BINARY | grep -v grep | awk '{print $2}'`" ]; then
    echo "the server seems to be running"
    exit 0
    else
    echo "the server seems to be stopped"
    exit 3
    fi
    ;;
    *)
    echo "Usage: $0 {start|stop|restart|status}"
    exit 2
    esac
    exit 0
    Save it as /etc/init.d/teamspeak3, customize your path, user and binary settings, make the file executable (chmod +x).

    The script is a modified version of the TS2 startscript ready for TS3.
    Last edited by florian_fr40; November 8th, 2011 at 04:59 PM.

  2. #2
    Join Date
    December 2009
    Location
    Netherlands
    Posts
    7
    Going to give it a shot tomorrow
    Will let you know the results, got the stuff working more then a day now without probs on fedora 10 x64, just want to know if it works or not so they could include it in the next release.

    Better way to do
    As root cd to /etc/init.d and then copy an existing script like "cp sshd teamspeak3" this will simplify the permissions issue with the file. Empty that file via putty or telnet and copy paste the above stuff in it.
    Then you just need to save it.
    My favo to open is "nano teamspeak3" to edit it, easier to use then vi , after adding the new stuff, just CTRL X and approve to close. and you have a file you can tricker that works.

  3. #3
    Join Date
    December 2009
    Location
    Germany
    Posts
    12
    This script is not capable of starting the server with any parameters and it will also not use any ini file.

    In order to start the server with an Ini-File and individual parameters I modified this line:

    Code:
    su -c "cd $DIR && $DIR/$BINARY" - $USER &>/dev/null &
    to

    Code:
    su -c "cd $DIR && $DIR/$BINARY inifile=ts3server.ini" - $USER &>/dev/null &
    Now the server uses the parameters from ts3server.ini within the installation directory. Refer to the server_quickstart.txt on how to create an ini file.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: April 7th, 2010, 03:34 PM
  2. Init script for new ts3server_startscript.sh?
    By Jimi` in forum Linux / FreeBSD
    Replies: 2
    Last Post: February 27th, 2010, 06:19 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
  •