Results 1 to 1 of 1
-
22-12-2009, 19:34 #1
-= TeamSpeak User =-
- Join Date
- Dec 2009
- Location
- Germany
- Posts
- 1
[Outdated] Start/stop TS3 Server in Debian Linux start-stop-daemon (not screen)
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
Hi,
I didn't like to start the TS3 Server by running screen, so I took the TS2 startup script and modified it to TS3. I'm posting my setup here with the hope to help some people.
I installed the files, which are in the distribution package, to /usr/local/lib/teamspeak3, that are:
Note: The doc/*, serverquerydocs/*, CHANGELOG and LICENSE could be in documentation directory, but it's not important.Code:doc/* serverquerydocs/* sql/* CHANGELOG LICENSE libts3db_mysql.so libts3db_sqlite3.so ts3server_linux_x86
Next I created the file /etc/default/teamspeak3:
Note: create a link to the engine object file in the data directory. In my example it would be:Code:#whether to start teamspeak 3 server on startup ENABLED=1 # the configuration file (inifile) CONF=/etc/teamspeak3/ts3server.ini # data directory # make sure to have a symbolic link to /usr/local/lib/teamspeak3/libts3db_<engine>.so in the data directory # this directory is, where the ts3server.sqlitedb goes, when using sqlite engine, also the files/ directory DATADIR=/DATA/teamspeak3
Next is /etc/teamspeak3/ts3server.ini:Code:cd /DATA/teamspeak3 ln -s /usr/local/lib/teamspeak3/libts3db_sqlite3.so
Notes:Code:machine_id= default_voice_port=9987 voice_ip=0.0.0.0 licensepath= filetransfer_port=30033 filetransfer_ip=0.0.0.0 query_port=10011 query_ip=0.0.0.0 dbplugin=ts3db_sqlite3 dbpluginparameter= dbsqlpath=/usr/local/lib/teamspeak3/sql/ dbsqlcreatepath=create_sqlite/ logpath=/var/log/teamspeak3 logquerycommands=0
- Don't forget to create /var/log/teamspeak3 (or whatever you use).
- I have no license (yet), so I couldn't test it. But the change should be minimal.
Now the most important: /etc/init.d/teamspeak3
Note: I have to run the server as root, because otherwise the "instance check error" appears.Code:#!/bin/sh ### BEGIN INIT INFO # Provides: teamspeak3 # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: TeamSpeak 3 Server # Description: VoIP chat ### END INIT INFO PATH=/usr/sbin:/usr/bin:/sbin:/bin DESC="Teamspeak 3 Server (VoIP chat)" NAME=teamspeak3 DAEMON=/usr/local/lib/teamspeak3/ts3server_linux_x86 PIDFILE=/var/run/$NAME.pid SCRIPTNAME=/etc/init.d/$NAME # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME DAEMON_ARGS="inifile=$CONF" # Exit if the package is not installed [ -x "$DAEMON" ] || exit 0 # Exit if not ENABLE=1 [ $ENABLED -eq 1 ] || exit 0 # 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 --start \ --quiet \ --pidfile $PIDFILE \ --chdir $DATADIR \ --background --make-pidfile \ --exec $DAEMON \ --test -- \ $DAEMON_ARGS >/dev/null 2>&1 \ || return 1 start-stop-daemon --start \ --quiet \ --pidfile $PIDFILE \ --chdir $DATADIR \ --background --make-pidfile \ --exec $DAEMON -- \ $DAEMON_ARGS >/dev/null 2>&1 \ || return 2 } # 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/30/KILL/5 \ --pidfile $PIDFILE RETVAL=$? # Delete pidfile when exit. rm -f $PIDFILE return "$RETVAL" } 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 ;; status) [ -e $PIDFILE ] && echo "$NAME seems to be running with pid: `cat $PIDFILE`." \ || echo "$NAME is not running." ;; restart|force-reload) 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|status|restart|force-reload}" >&2 exit 3 ;; esac
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!
Test your setup by manually running /etc/init.d/teamspeak3 start|stop|restart. If everything worked fine, you can use "update-rc.d teamspeak3 defaults" (or something like that) to create the startup and kill links in /etc/rc*.d/ (or do it manually).
nixLast edited by florian_fr40; 09-11-2011 at 15:45.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
How do you stop/start your server?
By bigbrother in forum [TeamSpeak 2] Server SupportReplies: 1Last Post: 25-04-2007, 23:47 -
Start stop script for TeamSpeak daemon (init)
By Cybernaut in forum [TeamSpeak 2] Server SupportReplies: 2Last Post: 11-11-2004, 17:07 -
[debian]Start/stop script
By muldereric in forum [TeamSpeak 2] Server SupportReplies: 2Last Post: 03-02-2004, 12:12


Reply With Quote