Forum

Results 1 to 8 of 8
  1. #1
    Join Date
    December 2009
    Location
    NL
    Posts
    6

    Re-adding '-pid=' option from TS2 server

    This section is probably more appropriate to place a feature request than the support section. My apologies for not putting it here in the first place.

    I'd like to request the return of the '-pid' option for the Linux version of the TS3 server. It makes it easier and more portable to send signals to the server by not relying on trickery with ps on the CLI (which is fragile on shared systems).

    The original thread is here.

    It served me well for TS2; I'd like to keep using this for TS3 as well.

  2. #2
    Join Date
    February 2005
    Location
    Roswell, GA
    Posts
    28
    Quote Originally Posted by Threbus View Post
    I'd like to request the return of the '-pid' option for the Linux version of the TS3 server. It makes it easier and more portable to send signals to the server by not relying on trickery with ps on the CLI (which is fragile on shared systems).
    You can do the same thing via a shell script - you can start TS3 as a daemon and then save the PID of the newly spawned process into a file.

    Cheers!

    Luke

  3. #3
    Join Date
    December 2009
    Location
    NL
    Posts
    6
    While possible, you're still relying on constructs such as ksh's $!. The server is well aware of its main process' PID (or can trivially figure it out), and can easily dump it to a file as well. It's the KISS solution, in my opinion.

  4. #4
    Join Date
    January 2006
    Location
    Australia
    Posts
    27
    Just like to add my support for this as well. It makes using debian's daemon tools more robust if the pid is output to a file on startup.

  5. #5
    Join Date
    February 2005
    Location
    Roswell, GA
    Posts
    28
    Quote Originally Posted by Threbus View Post
    While possible, you're still relying on constructs such as ksh's $!. The server is well aware of its main process' PID (or can trivially figure it out), and can easily dump it to a file as well. It's the KISS solution, in my opinion.
    I can't disagree with you there. Having the server dump the PID to a file is the best solution.

    Additionally, would it be possible for the server to shutdown on SIGINT rather than SIGTERM?

    Cheers!

    Luke

  6. #6
    Join Date
    December 2009
    Location
    Germany
    Posts
    6
    Of course I agree that a program spitting out its own pid to a file happens to be quite helpful, but the reason TeamSpeak 3 does not do that any more is simple: It does not fork itself to background, whereas TeamSpeak 2 does. Thus the former is no daemon and only those are supposed to write a pid-file.

    I set up a really simple script that takes care of forking/daemonization, switching to a different user and the PID-issue. It relies on start-stop-daemon, which should be present in any major linux-distribution. If it's not in yours, get it, because it's a very useful tool.

    Here's the source-code, if you guys wanna use it.

    Code:
    #/bin/sh
    
    TS3_DIR="/home/ts3"
    TS3_UID="ts3"
    TS3_GID="ts3"
    
    case "$1" in
    	start)
    		/sbin/start-stop-daemon --verbose --start --exec "$TS3_DIR/ts3server" --pidfile "$TS3_DIR/ts3server.pid" --make-pidfile --chdir "$TS3_DIR" --chuid "$TS3_UID:$TS3_GID"
    	;;
    
    	start-daemon)
    		/sbin/start-stop-daemon --verbose --start --exec "$TS3_DIR/ts3server" --pidfile "$TS3_DIR/ts3server.pid" --make-pidfile --chdir "$TS3_DIR" --chuid "$TS3_UID:$TS3_GID" --background
    	;;
    
    	stop)
    		/sbin/start-stop-daemon --verbose --stop  --exec "$TS3_DIR/ts3server" --pidfile "$TS3_DIR/ts3server.pid" --user "$TS3_UID"
    	;;
    
    	*)
    		echo "$0 (start|start-daemon|stop)"
    	;;
    esac
    EDIT: Sourcecode on pastebin.ca -> proper formatting and syntax highlighting
    Last edited by Actium; December 28th, 2009 at 11:55 AM.

  7. #7
    Join Date
    December 2009
    Location
    NL
    Posts
    6
    Quote Originally Posted by Actium View Post
    [...] a program spitting out its own pid to a file happens to be quite helpful, but the reason TeamSpeak 3 does not do that any more is simple: It does not fork itself to background, whereas TeamSpeak 2 does. Thus the former is no daemon and only those are supposed to write a pid-file.
    I cannot find why TS3 does not fork and detach from the terminal and it seems an atypical choice. Did I miss something obvious in the documentation?

    Long running services not requiring intervention from the terminal typically come in daemon form. They often also have the (non-default) option to run them in the foreground (not detaching) for debugging purposes.

    TS3 does not seem any different from, say, Postfix or Bind in that it should run for longer periods of time and doesn't require terminal interaction.

    For simple consistency with other Unix daemons, I suggest adding a 'debug/do not detach' option, as well as returning the old '-pid' option. By default the TS3 process would then detach again. It also stops the issues people are having along the lines of "when I close Putty...". Is there a reason not to do this?

  8. #8
    Join Date
    May 2007
    Location
    Eastern NC
    Posts
    1,798
    Since TS3 is still in beta I would guess that "debugging" mode is an assumed default right now and why they don't have it forking/detaching. Only one of the devs could really answer that though. I've seen some commands for running it in a way that does not attach it to the terminal window, but I don't think any of them included the PID part of what you are looking for.
    Last edited by Screech; January 20th, 2010 at 04:28 PM. Reason: typo

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Adding a plugin to my server on a Mac
    By Tudjay in forum General Questions
    Replies: 3
    Last Post: July 26th, 2012, 06:44 PM
  2. Adding a virtual server
    By twpeagle in forum Linux / FreeBSD
    Replies: 14
    Last Post: April 15th, 2012, 03:08 PM
  3. Adding NPL to Mac OS server
    By Jeremiah in forum General Questions
    Replies: 1
    Last Post: February 28th, 2012, 07:26 AM
  4. Adding Server Icons
    By Anarchy Commander in forum Windows
    Replies: 4
    Last Post: November 17th, 2010, 06:50 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
  •