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 9 of 9
  1. #1
    Join Date
    July 2008
    Location
    germany
    Posts
    4

    Exclamation Linux-Startscript for Teamspeak3 (without screen)

    Hi Community,

    i don't know why ts startscript have to use screen.
    I think the "nice to have" in startscripts with screen are the "watch" function. but this is the same you can do with tail -f yourts3logfilehere.log. I don't need this "nice to have" so I wrote my own one.
    The following script can use and modify from everyone

    http://www.zeitsofa.de/uploads/teamspeak3

    Special thanks to Crytix from inc-gaming.net for the parameters part

    Have a lot of fun and i wish you all a merry christmas

    zeitsofa

  2. #2
    Join Date
    December 2009
    Location
    Germany
    Posts
    11
    nice script, exactly what i have searched. good job
    merry xmas

  3. #3
    Join Date
    December 2009
    Location
    Germany
    Posts
    2
    Jep, thx for this nice script.

    Guten Rutsch!

  4. #4
    Join Date
    August 2005
    Location
    Nederland
    Posts
    56
    Thanks, great script

  5. #5
    Join Date
    August 2005
    Location
    Nederland
    Posts
    56
    When restarting my centos server the .pid file does not gets deleted, and the server does not startup automatically ...

  6. #6
    Join Date
    April 2008
    Location
    Next to Hannover
    Posts
    212
    you should learn more over linux.. oO
    if the server must start on serverstartup, you must create an crontab

  7. #7
    Join Date
    August 2005
    Location
    Nederland
    Posts
    56
    Quote Originally Posted by Denniminator View Post
    you should learn more over linux.. oO
    if the server must start on serverstartup, you must create an crontab
    Lol you make me laugh really hard dude

  8. #8
    Join Date
    January 2010
    Location
    Baton Rouge, LA, USA
    Posts
    1

    Startup script for Ubuntu server

    Hey guys,

    Here is a script I made for Ubuntu Linux that doesn't use screen, and can be added using update-rc.d to automatically start the TeamSpeak server at boot time. It's just customized from the Ubuntu init.d script template.

    Of course, use at your own risk, I don't take responsibility for people's servers blowing up and so forth. I can tell you that I've been running this script in production since the early v3 betas with no problem whatsoever.

    zeitsofa, my apologies if this is similar to your script -- I tried to download it but could not connect to server.

    How to use:
    1. Login as root
    2. Create a new file called "ts3server" in /etc/init.d
    3. Using your favorite editor, paste the contents of the script below into that file
    4. Modify script variables
      • DAEMON_FOLDER - the directory where TeamSpeak is installed
      • CHUID - the user who you wish to run TeamSpeak as (should NEVER be root)
      • DAEMON_ARGS - the command-line params to start TeamSpeak
    5. Save and exit editor
    6. Add execute permission:
      Code:
      chmod a+x /etc/init.d/ts3server
    7. Install into rc.d:
      Code:
      update-rc.d ts3server defaults
    8. Enjoy :-)


    Also, make sure the user listed for CHUID has r/w rights to your TeamSpeak directory and all files.

    Now you can start your TeamSpeak server using the same syntax as any other daemon:
    Code:
    /etc/init.d/ts3server start|stop|restart
    If after starting, you don't see TeamSpeak running, make sure to clear the contents of /dev/shm. This can happen if you originally ran the server using a different user than what's listed in the CHUID variable.

    Hope this helps someone.
    Greg

    Code:
    #! /bin/sh
    ### BEGIN INIT INFO
    # Provides:          ts3server
    # Required-Start:    $local_fs $remote_fs
    # Required-Stop:     $local_fs $remote_fs
    # Default-Start:     2 3 4 5
    # Default-Stop:      S 0 1 6
    # Short-Description: Example initscript
    # Description:       This file should be used to construct scripts to be
    #                    placed in /etc/init.d.
    ### END INIT INFO
    
    # Author: gregg1ep00
    
    # Do NOT "set -e"
    
    # PATH should only include /usr/* if it runs after the mountnfs.sh script
    PATH=/usr/sbin:/usr/bin:/sbin:/bin
    DESC="Teamspeak v3"
    NAME=ts3server
    DAEMON_FOLDER=/var/opt/teamspeak/ts3
    DAEMON=$DAEMON_FOLDER/$NAME
    CHUID=teamspeak
    DAEMON_ARGS="default_voice_port=1337 dbplugin=ts3db_mysql dbpluginparameter=ts3db_mysql.ini dbsqlcreatepath=create_mysql/"
    PIDFILE=/var/run/$NAME.pid
    SCRIPTNAME=/etc/init.d/$NAME
    
    # Exit if the package is not installed
    [ -x "$DAEMON" ] || exit 0
    
    # Read configuration variable file if it is present
    [ -r /etc/default/$NAME ] && . /etc/default/$NAME
    
    # Load the VERBOSE setting and other rcS variables
    [ -f /etc/default/rcS ] && . /etc/default/rcS
    
    # Define LSB log_* functions.
    # Depend on lsb-base (>= 3.0-6) to ensure that this file is present.
    . /lib/lsb/init-functions
    
    #
    # Function that starts the daemon/service
    #
    do_start()
    {
            # Return
            #   0 if daemon has been started
            #   1 if daemon was already running
            #   2 if daemon could not be started
            start-stop-daemon \
                    --chuid $CHUID \
                    --chdir $DAEMON_FOLDER \
                    --start \
                    --quiet \
                    --pidfile $PIDFILE \
                    --exec $DAEMON \
                    --test \
                    || return 1
            start-stop-daemon \
                    --chuid $CHUID \
                    --chdir $DAEMON_FOLDER \
                    --start \
                    --quiet \
                    --background \
                    --pidfile $PIDFILE \
                    --exec $DAEMON -- \
                    $DAEMON_ARGS \
                    || return 2
            # Add code here, if necessary, that waits for the process to be ready
            # to handle requests from services started subsequently which depend
            # on this one.  As a last resort, sleep for some time.
    }
    
    #
    # Function that stops the daemon/service
    #
    do_stop()
    {
            # Return
            #   0 if daemon has been stopped
            #   1 if daemon was already stopped
            #   2 if daemon could not be stopped
            #   other if a failure occurred
            start-stop-daemon --stop --quiet --retry=TERM/5/KILL/5 --pidfile $PIDFILE --name $NAME
            RETVAL="$?"
            [ "$RETVAL" = 2 ] && return 2
            # Wait for children to finish too if this is a daemon that forks
            # and if the daemon is only ever run from this initscript.
            # If the above conditions are not satisfied then add some other code
            # that waits for the process to drop all resources that could be
            # needed by services started subsequently.  A last resort is to
            # sleep for some time.
            start-stop-daemon --stop --quiet --oknodo --retry=0/5/KILL/5 --exec $DAEMON
            [ "$?" = 2 ] && return 2
            # Many daemons don't delete their pidfiles when they exit.
            rm -f $PIDFILE
            return "$RETVAL"
    }
    
    #
    # Function that sends a SIGHUP to the daemon/service
    #
    do_reload() {
            #
            # If the daemon can reload its configuration without
            # restarting (for example, when it is sent a SIGHUP),
            # then implement that here.
            #
            start-stop-daemon --stop --signal 1 --quiet --pidfile $PIDFILE --name $NAME
            return 0
    }
    
    case "$1" in
      start)
            [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME"
            do_start
            case "$?" in
                    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
            esac
            ;;
      stop)
            [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
            do_stop
            case "$?" in
                    0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
                    2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
            esac
            ;;
      #reload|force-reload)
            #
            # If do_reload() is not implemented then leave this commented out
            # and leave 'force-reload' as an alias for 'restart'.
            #
            #log_daemon_msg "Reloading $DESC" "$NAME"
            #do_reload
            #log_end_msg $?
            #;;
      restart|force-reload)
            #
            # If the "reload" option is implemented then remove the
            # 'force-reload' alias
            #
            log_daemon_msg "Restarting $DESC" "$NAME"
            do_stop
            case "$?" in
              0|1)
                    do_start
                    case "$?" in
                            0) log_end_msg 0 ;;
                            1) log_end_msg 1 ;; # Old process is still running
                            *) log_end_msg 1 ;; # Failed to start
                    esac
                    ;;
              *)
                    # Failed to stop
                    log_end_msg 1
                    ;;
            esac
            ;;
      *)
            #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2
            echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
            exit 3
            ;;
    esac
    
    :
    **EDIT** I just realized that nixniemand has a very similar script already posted for Debian here. Mine was created for Ubuntu 8.04 LTS. He lists a very important warning, which I forgot to mention:

    WARNING: If you start the TS3 Server for the first time, you should NOT use the /etc/init.d/teamspeak3 script, because then you will never see the admin's serverquery account password!
    Last edited by gregg1ep00; January 22nd, 2010 at 07:37 AM. Reason: found another similar script

  9. #9
    Join Date
    August 2005
    Location
    Nederland
    Posts
    56
    Any change to update so the script works with the newest beta (17) again?

    After changing 1 line to the new .sh file from teamspeak the server start but doesn't restart or stops.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [DEBIAN] Trying to start teamspeak3 server with screen
    By Ghostaunt in forum Linux / FreeBSD
    Replies: 22
    Last Post: November 10th, 2013, 11:55 AM
  2. Replies: 13
    Last Post: September 1st, 2013, 11:54 AM
  3. Replies: 100
    Last Post: August 17th, 2012, 07:38 PM

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
  •