Forum

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Join Date
    January 2010
    Location
    Arizona
    Posts
    4

    Linux TS3 Server Autostart 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


    ADMINS you may want to sticky this topic!!

    This will work on Centos, Red Hat, and is untested but should work on Fedora and any RHEL(Red Hat Enterprise Linux) compatible system.

    here we go guys, this script will kick TS3 into action at server start automatically.

    This script will register TS3 as a Linux System Service so that it starts and stops automatically with the systems startup and shutdown, and i have it working wonderfully with the Teamspeak 3 webadmin from HobbitNoob(http://forum.teamspeak.com/showthread.php?t=48395)

    first make sure to change the line
    cd teamspeak3-server_linux-amd64
    to match the folder where "ts3server_linux_amd64" or your architectures starter file is located!

    if needed also edit the following line for machines that are not 64bit
    nohup ./ts3server_linux_amd64 &

    Code:
    #! /bin/sh
    # Basic support for IRIX style chkconfig
    ###
    # chkconfig: 2345 98 55
    # description: Manages the services you are controlling with the chkconfig command
    ###
    
    case "$1" in
      start)
            echo -n "Starting ts3"
            cd teamspeak3-server_linux-amd64
            nohup ./ts3server_linux_amd64 &
            echo "."
            ;;
      stop)
            echo -n "Stopping ts3"
            pkill ts3server_linux
            echo "."
            ;;
    
      *)
            echo "Usage: /sbin/service ts3 {start|stop}"
            exit 1
    esac
    
    exit 0
    save that as filename "ts3" into your servers "/etc/rc.d/init.d" path!

    make sure root owns the file
    chmod it to 777

    change to the "/etc/rc.d/init.d" directory and run the following commands!

    sudo chkconfig --add ts3
    sudo chkconfig --level 2345 ts3 on
    service ts3 start

    now if done correctly TS3 will autostart at system boot.

    after this is installed you can do the following commands to start or stop the TS3 daemon manually

    service ts3 stop

    or

    service ts3 start
    Last edited by dante696; February 21st, 2011 at 12:11 PM.

  2. #2
    Join Date
    January 2010
    Location
    Arizona
    Posts
    4
    HobbitNoobs webadmin is a pain to setup for the first time because the documentation is a bit dry, this config will work for almost any server provided TS3 is running on the same box as it is.

    Code:
    <?php
    
    define("TSADMINHOST", "127.0.0.1"); 
    define("TSADMINPORT", "10011"); 
    define("LANG","en");   // Language for the webadmin
    define("THEME", "standard");   // path for theme in theme folder
    define("LIVE", TRUE);					// Check for new Server Update
    define("NEWS", TRUE);					// Fetch developer Blog news
    define("FIXLOGINUSER", FALSE);  // Standart Login "serveradmin" readonly on true
    define("COMENT", FALSE);
    define("HOLDONERROR", TRUE);    // Hold on if an error exist
    define("NEWSSERVER", "http://ts3interface.de/news");
    
    // Don't change these lines  
    define("INCDIR", "inc/");
    require("lang/".LANG.".inc.php");
    require(ROOTDIR.INCDIR."functions.inc.php");
    require(ROOTDIR.INCDIR."ts3admin.class.php");
    
    $tsAdmin = &new ts3admin(TSADMINHOST, TSADMINPORT);
    $tsAdmin->connect();
    
    ?>
    With your TS3 client connected to your server use the serveradmin token it gave you, MENU > PERMISSIONS > USE TOKEN!

    Then go to
    MENU > PERMISSIONS > SERVERQUERY LOGIN!

    Set your webadmin username, and it will give you a random password!

    now just login to the webadmin!

  3. #3
    Join Date
    December 2009
    Location
    Netherlands
    Posts
    25
    your script cannot handle options or ini specifications so only users with basic settings can use it.

    Take a look at this: http://forum.teamspeak.com/showthread.php?t=47763

    You might like it. Why do you run it as root? That's not wise, adding something as a service will run as root standard.

  4. #4
    Join Date
    January 2010
    Location
    Arizona
    Posts
    4
    my script is simple and easy for those new to linux to figure out.

    and with properly installed iptables, the risk of running it as root is neglidgable.

    also people who do know linux can simple change 1 line to add "sudo" and run it as any user they want.

    on a server with gameservers, ts and many other things running, i dont feel like having to go into putty or the local terminal to start a voip server!

    with this script its done for you!

    Also any server used in production that requires manual startup of any regularly used service is just a poor technical practice!

    if the server reboots with my script in place, rather than having to find out TS3 is down and shell in to start it, it will always just start itself, the box boots and does everything autonomously!

    How do you think the paid providers do things, do you really think every time a server reboots they have someone remote in to start TS3 or other daemons?

    NOPE, they have it setup just like mine!

    You also dont have to remember exactly where TS3 is installed since its registered as a service linux knows where it is, just from any folder you can do service ts3 (stop/start) when you need to manually do anything!

  5. #5
    Join Date
    April 2010
    Location
    Germany
    Posts
    1

    Question how to integrate "respawn"

    how to integrate "respawn", so the server starts again when the process is killed or terminated? i don't want to use a cronjob for this because its to unflexible..
    thx for help
    Last edited by badguy2003st; April 20th, 2010 at 08:54 PM.

  6. #6
    Join Date
    December 2009
    Location
    Germany
    Posts
    19
    does the script work under ubuntu?

    How can i start under a different user?

  7. #7
    Join Date
    August 2008
    Location
    Whois
    Posts
    586
    sorry but this script is superfluously use cron!

    http://en.wikipedia.org/wiki/Cron
    http://de.wikipedia.org/wiki/Cron

  8. #8
    Join Date
    December 2009
    Location
    Germany
    Posts
    19
    i'm a noob with linux

  9. #9
    Join Date
    August 2008
    Location
    Whois
    Posts
    586
    Create a easy Script named: ts3_check.sh ( chmod 777 )
    Code:
    #!/bin/sh
    ps ax | grep -v "grep ts3server_linux_x86" | grep ts3server_linux_x86 || /home/teamspeak3/ts3server_linux_x86
    next step:

    Code:
    crontab -e
    and insert the following lines:
    30 0 * * * /home/teamspeak3/ts3_check.sh
    ( edit the red marked text for you own configuration! )

    Finished...

    Oh my gosh! Google helps me!
    http://www.webmaster-toolkit.com/cron-generator.shtml

  10. #10
    Join Date
    October 2010
    Location
    UK
    Posts
    1
    I hope you don't mind but I've made a small change to the script. For those who do not want to run as root. you can just do the follow:

    Code:
    #! /bin/sh
    # Basic support for IRIX style chkconfig
    ###
    # chkconfig: 2345 98 55
    # description: Manages the services you are controlling with the chkconfig command
    ###
    
    case "$1" in
      start)
            echo -n "Starting ts3"
             sudo -u ts /home/ts/teamspeak3-server_linux-amd64/./ts3server_startscript.sh start
            ;;
      stop)
            echo -n "Stopping ts3"
             sudo -u ts /home/ts/teamspeak3-server_linux-amd64/./ts3server_startscript.sh stop
            ;;
    
      *)
            echo "Usage: /sbin/service ts3 {start|stop}"
            exit 1
    esac
    
    exit 0
    You'll just need to change the path and what user it runs as. Mine is running as user ts
    all you need to do is change the
    sudo -u username

    and the path to where your ts3 is installed. just make sure you change it in the stop and the start command.
    Last edited by PooKer; October 20th, 2010 at 04:27 PM. Reason: changed quotes into codes

  11. #11
    Join Date
    December 2009
    Location
    Malta
    Posts
    14
    hello iam beginner in ssh and linux, my server working in

    /root/teamspeak3

    i fallow everysteps in installation.
    http://img403.imageshack.us/img403/6749/capturets.png
    i got error like that.

  12. #12
    Join Date
    June 2010
    Location
    Germany
    Posts
    28
    Quote Originally Posted by MasterXBKC View Post
    chmod it to 777
    congratulations you just created a privilege escalation exploit on your system.

    NEVER EVER set a rc file to world-writeable. anyone on your system could change the file, to install rootkits or other stuff and then just wait until the machine gets rebootet the next time to have the code executed as root.

    Code:
    chown root:root <file>
    chmod 755 <file>
    should do fine.

  13. #13
    Join Date
    October 2010
    Location
    Poland
    Posts
    8
    Code:
    $ crontab -e
    Code:
    reboot /home/teamspeak3/ts3server_startscript.sh restart
    done...

  14. #14
    Join Date
    March 2011
    Posts
    2

    Question Dummy Needs help fedora linux VM server, which we run a ts3 server on

    we have a fedora linux VM server, which we run a ts3 server on... The software is installed here "... include folder path)" and it runs under this account... exactly how do you create a script file that will run the ts3 script when the server boots

  15. #15
    Join Date
    January 2010
    Location
    Germany
    Posts
    80
    Just add a crontab:

    @reboot ./ tsstartscript...

    You have to enter the right path and name for the script

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Linux autostart script
    By Ar2rJke in forum Linux / FreeBSD
    Replies: 1
    Last Post: October 12th, 2011, 10:04 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
  •