Forum

Results 1 to 12 of 12
  1. #1
    Join Date
    December 2009
    Location
    USA
    Posts
    8

    Exclamation Nice And Easy Linux Start 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



    Hello All,

    If you are like me and like to have a simple script with lots of options you will like this.

    To get the script:
    Code:
    wget http://scripts.the009.net/shell/ts3/startscript
    Now you will need to edit the 4th line down in that file with your favorite editor
    change the line to match your information:
    cd /teamspeak/teamspeak3-server_linux-x86
    Now once you have that done, you will need to CHMOD that file to be able to run.

    Code:
    chmod +x startscript
    Now that is done you will need the config file for the startscript.

    Code:
    wget http://scripts.the009.net/shell/ts3/startscript.conf
    You will need to edit the config file to match your stuff.

    Once you have all that done its very simple to start or watch what is happening to your server or even stop or restart it.

    To start the server use:
    Code:
    ./startscript start
    To Stop your server use:
    Code:
    ./startscript stop
    To Restart your server use:
    Code:
    ./startscript restart
    To watch what your server is doing use:
    Code:
    ./startscript watch
    IMPORTANT INFORMATION:

    If you are watching your server with ./startscript watch you must close the screen before exiting your shell.

    Use:
    Code:
    CTRL + A + D
    Hope that helps all of you out.

    Regards,
    The009

    PS: If this could be stickied for quick find for help that would be awesome.
    Last edited by dante696; February 21st, 2011 at 12:24 PM. Reason: Asking For Sticky

  2. #2
    Join Date
    December 2009
    Location
    Germany
    Posts
    27
    In this script the startparms in this startscript (http://forum.teamspeak.com/showthread.php?t=47075) . The idea, use the config is very usefull after first start. Thanks for inspiration

  3. #3
    Join Date
    December 2009
    Location
    USA
    Posts
    8
    I like using config file because it keeps the clutter and everything down.

    There is no need to have to look though a ton of coding or other things with a config file and then an actual start script.

  4. #4
    Join Date
    December 2009
    Location
    az usa
    Posts
    4
    does this script keep the server running 24/7??

  5. #5
    Join Date
    May 2007
    Location
    Germany
    Posts
    9
    This is what you have to type if you want to start the server 24/7:
    Code:
    screen -A -m -d -S ts3 ./ts3server_linux_x86
    To Detach the screen press CTRL + A simutaniously and then hit you d key.
    To Reattach type
    Code:
    screen -r ts3
    hint: you must have installed screen (apt-get install screen)

  6. #6
    Join Date
    December 2009
    Location
    USA
    Posts
    8
    Quote Originally Posted by 1josh13 View Post
    does this script keep the server running 24/7??
    Yes this keeps the server running 24/7

    It dose much more then the last person said to do, as for they just gave you a way to create the screen, the script I provided makes it much simpler to understand.

  7. #7
    Join Date
    March 2005
    Location
    Germany
    Posts
    50
    why not just start the server with:
    Code:
    ./ts3server_linux_x86 &

  8. #8
    Join Date
    December 2009
    Location
    USA
    Posts
    8
    Quote Originally Posted by Hitme View Post
    why not just start the server with:
    Code:
    ./ts3server_linux_x86 &
    Because I like to have a little more control over things, and I like to be able to watch what is going on live without having to tail the log file.

  9. #9
    Join Date
    June 2007
    Location
    in a house.
    Posts
    98
    why is everyone using screen ???
    my TS3 on my nix box is running without screen... and no active SSH for it..
    i dont get it...

  10. #10
    Join Date
    December 2009
    Location
    Germany
    Posts
    4
    Here is a script without screen, uses debian start-stop-daemon. Sould be running on debianbased distributions.
    Just pass user, group, directory and your options

    Code:
    #!/bin/bash
    #Teamspeak 3 startup script
    
    PATH=/sbin:/bin:/usr/sbin:/usr/bin:$DIR
    
    #Server options
    NAME="TeamSpeak 3 Server"
    DESC="tss3"
    DIR="/home/tss3"
    BIN="ts3server_linux_x86"
    
    PIDFILE="/home/tss3/tss3.pid"
    PARAMS="inifile=ts3server.ini"
    
    USER="tss3" # DO NOT USE root
    GROUP="tss3" #  DO NOT USE root
    
    ### Do not edit anything below this line ###
    
    set -e
    export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:."
    . /lib/lsb/init-functions
    
    
    if [ ! -d "$DIR" ]; then
      log_failure_msg "Directory does not exist!"
      exit 0
    fi
    
    if [ ! -e "$DIR/$BIN" ]; then
      log_failure_msg "$BIN does not exist!"
      exit 0
    fi
    
    if [ ! -x "$DIR/$BIN" ]; then
      log_failure_msg "$BIN not executable!"
      exit 0
    fi
    
    if [ -z "$USER" ]; then
      log_failure_msg "Username is not set!"
      exit 0
    fi
    
    if [ -z "$GROUP" ]; then     
      log_failure_msg "GROUP is not set!"                                   
      exit 0
    fi
    
    TEST=`ps ax | grep $BIN | grep -v grep | wc -l`
    
    start()
    {
    if [ $TEST = 1 ]; then
      log_begin_msg "$NAME already running with Pid: `tail $PIDFILE`"
    else
      log_progress_msg "Starting $NAME"
      start-stop-daemon --start --chdir $DIR --exec $DIR/$BIN --startas $BIN --make-pidfile --pidfile $PIDFILE --user $USER --group $GROUP --chuid $USER:$GROUP --background -- $PARAMS
      chown $USER:$GROUP $PIDFILE
      log_end_msg 0
    fi
    }
    
    stop()
    {
    if [ ! $TEST = 1 ]; then
      log_begin_msg "$NAME not running!"
    else
      log_progress_msg "Stopping $NAME"
      start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --user $USER --exec $DIR/$BIN
      rm -rf $PIDFILE
      log_end_msg 0
    fi
    }
    
    restart()
    {
      echo "Stopping $NAME"
      start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE --user $USER --exec $DIR/$BIN
      rm -rf $PIDFILE
      sleep 1
      echo ...
      echo "Starting $NAME"
      start-stop-daemon --start --chdir $DIR --exec $DIR/$BIN --startas $BIN --make-pidfile --pidfile $PIDFILE --user $USER --group $GROUP --chuid $USER:$GROUP --background -- $PARAMS
      chown $USER:$GROUP $PIDFILE
    }
    
    status()
    {
    if [ $TEST = 1 ]; then
      echo "$NAME running with Pid: `tail $PIDFILE`"  
    else  
      echo "$NAME not running"
    fi 
    }
    
    case "$1" in
      start)
        start
        ;;
    
      stop)
        stop
        ;;
    
      restart|force-reload)
        restart
        ;;
    
      status)
        status
        ;;
    
      *)
        log_success_msg "Usage: $0 {start|stop|restart|force-reload|status}" >&2
        exit 1
        ;;
    esac
    
    exit 0
    Start teamspeak after reboot, copy script to /etc/init.d/tss3
    Code:
    update-rc.d tss3 defaults

    When you running monit for monitoring you can add:
    Code:
    check process ts3server_linux_x86 with pidfile /home/tss3/tss3.pid
      start program = "/etc/init.d/tss3 start"             
      stop program  = "/etc/init.d/tss3 stop"
      if failed host YOURIP port YOURPORT type udp
      then restart
    Last edited by get.the.MaX; December 25th, 2009 at 10:45 PM.

  11. #11
    Join Date
    December 2009
    Location
    USA
    Posts
    8
    I run CentOS so things are a bit different then debian.

    But the script should work on all of the Distros.

    Hopefully people have found it helpful.

  12. #12
    Join Date
    December 2009
    Location
    USA
    Posts
    8
    Hello,

    If you got this script Before Beta 17 Please Change Your startscript.conf

    DSNAME='ts3server_minimal_runscript.sh';

    To Match That As Above, IF you are just getting this script. It will work fine for you.

    Regards,
    The009

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. My start.sh script for Linux
    By bytecode77 in forum Linux / FreeBSD
    Replies: 0
    Last Post: March 1st, 2015, 01:11 PM
  2. Linux server quick and easy install and start script
    By Arandas in forum Linux / FreeBSD
    Replies: 1
    Last Post: May 22nd, 2011, 01:47 AM
  3. Linux server quick and easy install and start script
    By Arandas in forum Tools / Web Based
    Replies: 0
    Last Post: May 18th, 2011, 12:58 AM

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
  •