View Full Version : Control script for TS2 (For Debian users)
Here is a script I wrote which sits in /etc/init.d, using the skeleton style and start-stop-daemon. Note the locations of the files. I also moved all the documentation into /usr/share/doc/tss2, with the permission style of the other packages.
About -DB. I heard that it could be broken if you change the name, which is why it's still server.db. I was able to successfully log into a ts2 server this created, however I am not familiar with what the server.db authenticates, so it may still be broken. I will investigate into this further.
PS: Looks like the formatting was a bit messed up. Oh well, tabs can be created on your side.
---------------------------------------------------
#! /bin/sh
#
# Debian-ized script to start/stop/restart TeamSpeak 2 Server.
#
# Created by Adar Dembo, 2002
#
# Modified: 8/31/02
# ---------
# + Changed pidfile location to /var/run/tss2 (Thanks ScratchMonkey!)
# + Changed logfile location to /var/log/tss2 (Thanks ScratchMonkey!)
#
# Notes
# -----
# Sleep value of 10 seconds chosen because start-stop-daemon
# takes roughly 6-7 seconds to shut down every thread.
#
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
DAEMON=/usr/sbin/server_linux
NAME=tss2
DESC="TeamSpeak 2 Server"
TSS_INI="/etc/tss2/tsserver2.ini"
TSS_LOG="/var/log/tss2/tsserver2.log"
TSS_PID="/var/run/tss2/tsserver2.pid"
TSS_DB="/etc/tss2/server.db"
test -x $DAEMON || exit 0
set -e
case "$1" in
start)
echo -n "Starting $DESC: $NAME"
start-stop-daemon --start --chuid $NAME:$NAME --quiet --pidfile $TSS_PID \
--exec $DAEMON -- -DB=$TSS_DB -INI=$TSS_INI -LOG=$TSS_LOG -PID=$TSS_PID
echo "."
;;
stop)
echo -n "Stopping $DESC: $NAME "
start-stop-daemon --stop --quiet --pidfile $TSS_PID \
--exec $DAEMON
echo "."
;;
restart)
echo -n "Restarting $DESC: $NAME"
start-stop-daemon --stop --quiet --pidfile $TSS_PID \
--exec $DAEMON
sleep 10
start-stop-daemon --start --chuid $NAME:$NAME --quiet --pidfile $TSS_PID \
--exec $DAEMON -- -DB=$TSS_DB -INI=$TSS_INI -LOG=$TSS_LOG -PID=$TSS_PID
echo "."
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart)" >&2
exit 1
;;
esac
exit 0
I forgot one thing. This is the line I used to create the tss2 user:
adduser --system --disabled-password --disabled-login --home /usr/share/doc/tss2 --no-create-home --group tss2
Hope this helps.
I just wanted to ask you, if you could "gpl" the init.d-script you offered in the posting above?
I just try to set up a Debian-Package (no official one!) and would like to use your script for it. I Promise i mention you within the docs-directory ;)
Sure, consider it GPL'd. Not sure if I'm supposed to do some fancy dance, or wave my arms around, or post some signature, but go ahead and use it, but yes, including mention for me would be nice :).
That being said, I'm not sure if you'll be able to package this in .deb format. Debian packages require the source code to be available under some kind of license (GPL, LGPL, Artistic License). I suppose it could fall under "non-free". Otherwise I would have packaged it myself :) But good luck in your project.
ScratchMonkey
31-08-2002, 22:44
Note that you could put the pid file in /var/run/tss2/tss2.pid. BIND uses this trick. That's what I did for my RPM.
Thanks for the suggestion ScratchMonkey. I updated the script to mirror that (edited my original post).
Originally posted by ScratchMonkey
Note that you could put the pid file in /var/run/tss2/tss2.pid. BIND uses this trick. That's what I did for my RPM.
If you could also let the Admins redirect the httpdocs-Directory, we would be able to install it as LFS wants programs to be installed. Until that, i'll create a .deb which installs it within /usr/local
Hope i've got enough time to package it until tomorrow ;)
Finally, i just finished my .deb-Archive.
Now i wanted to ask the staff of teamspeak, if i may distribute it (for free and including your slicense.txt of course)?
If you want to see this package before, please let me know: roman dot kreisel at epost dot de
If you want to, we could also distribute if via your downloads-page, i think it would be much easier for debian users to install the programm.
Originally posted by Sidious
Finally, i just finished my .deb-Archive.
Very well done, guys. I would be interested in this .deb since I'm a Debian user. Will this always ben an unofficial package or do you plan to register it with Debian? It would also be cool if they could provide a link to your .deb from the teamspeak.org web site.
- AK
Originally posted by AKshun
Very well done, guys. I would be interested in this .deb since I'm a Debian user. Will this always ben an unofficial package or do you plan to register it with Debian? It would also be cool if they could provide a link to your .deb from the teamspeak.org web site.
- AK
I won't distribute my package until the authors gave me their O.K., cause I respect their work and really don't want them to be angry on me ;)
As soon as they gave me their OK, i'll look for a nice place to host the file(s) and you'll get access to it.
Well now, the packages are created, The tss-team gave me their ok and now it's up to me to make it public ;)
To install it, use ONE of the following steps:
a) Download http://elli-dietmar.kreisel.bei.t-online.de/debian/dists/testing/net/binary-i386/tss_2.0.17-1_i386.deb and install it using
dpkg -i tss_2.0.17-1_i386.deb
b) add the following line to your sources.list:
deb http://elli-dietmar.kreisel.bei.t-online.de/debian testing net
then execute:
apt-get update && apt-get install tss
Please report package-related bugs (and only those!) directly to me: roman dot kreisel at epost dot de
Hmm, I want to download this, but then extract it and check out the scripts, not install it. Do you know the appropriate commands for that?
Originally posted by Echo
Hmm, I want to download this, but then extract it and check out the scripts, not install it. Do you know the appropriate commands for that?
I'd read, that debian-archives are only ar-archives (not tar) which contains 2 .tar.gz-archives. So you only need to unar and untar it. But i prefer to have a look in the package using the midnight commander, he can handle the file format of the debian-archives ;)
If both methods don't work, please give me feedback and i'll send you the scripts.
Alright, I'm examining your scripts now, and will post my comments:
-In /etc/init.d/tss, a few things. First of all, I question your use of /usr/local/tss as the binary directory. I would recommend placing the binary in /usr/bin, which is more standard. This would also allow you to remove the "cd path/to/binary" line, as /usr/bin would be in the path. I also recommend changing "sleep 10" to "sleep $SLEEP_VALUE" so people can modify it at the top if they wish. May also wish to throw in a few comments documenting things that can be tweaked. Furthermore, I recommend changing ALL instances of "tss" to "tss2", as this is the "TeamSpeak Server 2" not "TeamSpeak Server" (server v1).
-After examining postinst, I understand why you chose /usr/local/tss. So that you could use that as the tss home directory as well. I recommend you place the home directory in the same directory as the documentation. For example, icecast-server (another Debian package), puts its home directory in /usr/share/icecast (Shared documentation location).
-In postinst, you can group similar looking 'chown' lines on the same line. For example:
chown -R tss:tss /usr/local/tss /etc/tss
This has the same effect
-I recommend removing the tss.SuSE and tss.minimal startscripts. They are redundant with the presence of the init.d script.
-md5sums is missing the sums for some files, namely those in etc/
-I am not familiar with this line in prerm:
# install-info --quiet --remove /usr/info/tss.info.gz
I see that you've commented it, but could you tell me what this does, and why it's commented? (I presume it's broken if uncommented?)
-So yeah, with all these changes, I recommend moving the slicense.txt and Readme.txt into the usr/share/doc/tss directory, and calling that the home directory. This will allow you to get rid of usr/local/tss, and place the binary in a more standard usr/bin.
Other than that, you've done a fantastic job! When these issues are addressed, I promise to test this out for you. Also, is it listed in the Debian archive yet? Have you filled an Intent To Package?
-In /etc/init.d/tss, a few things. First of all, I question your use of /usr/local/tss as the binary directory. I would recommend placing the binary in /usr/bin, which is more standard. This would also allow you to remove the "cd path/to/binary" line, as /usr/bin would be in the path.
The Problem is NOT the binary itself but the "httpdocs"-directory. It seems, like the tss uses the current directory and searches the httpdocs-Directory only in there. Anyway i could've moved the binary itself into /usr/bin. But anyone who starts the binary from there directly wouldn't have a web-interface on this server! As long as i cannot specify where it should get the contents of httpdocs from using the ini-file or a parameter, i won't change it. It could cause too much trouble for people wondering why they cannot get a web-interface.
I also recommend changing "sleep 10" to "sleep $SLEEP_VALUE" so people can modify it at the top if they wish. May also wish to throw in a few comments documenting things that can be tweaked.
Well, that's something i can change. But i'll wait a few days, maybe there are more things to do.
Furthermore, I recommend changing ALL instances of "tss" to "tss2", as this is the "TeamSpeak Server 2" not "TeamSpeak Server" (server v1).
I thought about that, too. But i wanted to take one name everywhere (tss2 or tss) and a package called "tss2-2.0.17-1.deb" wouldn't be ok.
-After examining postinst, I understand why you chose /usr/local/tss. So that you could use that as the tss home directory as well. I recommend you place the home directory in the same directory as the documentation. For example, icecast-server (another Debian package), puts its home directory in /usr/share/icecast (Shared documentation location).
The documentation is always placed in /usr/share/doc/packagename in Debian. The i could place the directory into /usr/share/tss, but i don't think there shouldn't be any binaries in /usr/share. So i hope the developers of tss give us the possibility to place the httpdocs-directory whereever we want it ;)
-In postinst, you can group similar looking 'chown' lines on the same line. For example:
chown -R tss:tss /usr/local/tss /etc/tss
This has the same effect
Didn't knew that, i'll change it in my next release. Anyway, i think that's a minor bug ;)
I recommend removing the tss.SuSE and tss.minimal startscripts. They are redundant with the presence of the init.d script.
I thought about that, too. But then i chose to leave it in there to hold the Package complete. Maybe we should start a vote 'bout it. Or just move the scripts to /usr/share/doc/tss?
-md5sums is missing the sums for some files, namely those in etc/
That's easy to complain: The ini-file isn't created when installing the package, but when the server is started the first time (Not by my scripts but by the binary itself). Then every installation gets a uniqe password. If i would use a standard-ini-file with a standard-password, it would be a security-hole if someone forgets to adjust the admin-password
-I am not familiar with this line in prerm:
# install-info --quiet --remove /usr/info/tss.info.gz
I see that you've commented it, but could you tell me what this does, and why it's commented? (I presume it's broken if uncommented?)
Don't know that either, it was created automatically by dpkg-buildpackage
-So yeah, with all these changes, I recommend moving the slicense.txt and Readme.txt into the usr/share/doc/tss directory,
I promise to do that in the next release of my package
and calling that the home directory. This will allow you to get rid of usr/local/tss, and place the binary in a more standard usr/bin.
1st: Where should i then place httpdocs? in /usr/share/docs? No! That's only the place where to put Documentation, not where to put the html-files for the webinterface!
2nd: Everyone who would start the binary directly from /usr/bin wouldn't have a webinterface (as i already mentioned above)
Other than that, you've done a fantastic job! When these issues are addressed, I promise to test this out for you.
Thanks ;)
Also, is it listed in the Debian archive yet? Have you filled an Intent To Package?
afaik it isn't easy to become a Debian-maintainer. Furthermore i don't think they're really interested in tss yet, cause
a) there isn't a windows client
b) on some machines it's far away from stable
c) It's not open-source. They HATE software which isn't open source ;)
Another thing i wanted to ask you: I just noticed, you're a native english-speaker. As you surely noticed, i'm not ;)
If there are any typos and/or unusual sentences within the Package, could you please report them, too?
To address your concerns. Firstly, I didn't consider the web-interface AT ALL, because I've never used it. I turned it off on my TS2 server from the get-go, and blocked both the web interface port and query port on my firewall. I can't stand to have so many ports open for one application. That being said, I had no idea httpdocs was required for it, I just thought it was a more comprehensive "online manual" for tss2.
We definitely need an additional command line argument, such as "-htdocs" to specify where the binary can find the httpdocs directory. Then this whole issue would go away. I think you've handled it correctly for now.
Regarding md5sums, the file in /etc that I was referring to was /etc/init.d/tss. It doesn't show up in the md5sums list.
Regarding naming conventions, here is how I see it:
"tss" = TeamSpeak Server
"tss2" = TeamSpeak 2 Server
"ts2" = Team Speak 2
So if you are looking for a unified name structure, I suggest:
"ts2-server" = TeamSpeak 2 Server
"ts2-client" = TeamSpeak 2 Client
This will easily allow a package for the client as well.
Regarding Intent To Package, I'm sure you could file it under non-free (there is an Archive section for that), and into the unstable pool. Not everything in the archive must be licensed, I think. I would e-mail a Debian developer about it. And don't worry about there not being a Linux client. The server alone is important enough.
ScratchMonkey
10-09-2002, 00:56
tss and tss2 can coexist on the same server, so give them unique package and directory names. At least until tss2 is stable enough that tss can be ignored. (This is what I do with my RPM.)
httpdocs should be under /usr/share/tss2, just as other packages with ancilliary files do. For now, that means one has to start the server from that directory, until the devs add a switch to specify the location of those files. (Until they fix it, I've put them in /etc/tss2/httpdocs, and started the program in /etc/tss2. Purely a workaround until the switch is available, though. (There was a problem with the -DB switch in the initial release that forced the server to be started in the same directory as the DB file.)
tss.info.gz is likely a placeholder for info-style documentation, which uses an emacs mode to display. If you have it installed, try "info info" to see its documentation.
Originally posted by ScratchMonkey
tss and tss2 can coexist on the same server, so give them unique package and directory names. At least until tss2 is stable enough that tss can be ignored. (This is what I do with my RPM.)
httpdocs should be under /usr/share/tss2, just as other packages with ancilliary files do. For now, that means one has to start the server from that directory, until the devs add a switch to specify the location of those files. (Until they fix it, I've put them in /etc/tss2/httpdocs, and started the program in /etc/tss2. Purely a workaround until the switch is available, though. (There was a problem with the -DB switch in the initial release that forced the server to be started in the same directory as the DB file.)
You must be kidding! You've put the binary into /etc/tss2? That's even worse than putting EVERYTHING into /usr/local and something i really won't do for my package!
ScratchMonkey
10-09-2002, 07:31
No, no! I run the binary from /etc/tss2. (Ie. that's the working directory.) The executable file is /usr/bin/tss2. (Renamed from the tarball.)
Now that the DB switch is working, my next release will probably set the working directory to /usr/share/tss2, and I'll put the httpdocs directory under that.
Originally posted by ScratchMonkey
No, no! I run the binary from /etc/tss2. (Ie. that's the working directory.) The executable file is /usr/bin/tss2. (Renamed from the tarball.)
Now that the DB switch is working, my next release will probably set the working directory to /usr/share/tss2, and I'll put the httpdocs directory under that.
And what, if someone starts the binary itself (maybe because he don't know how to handle init.d-scripts or just because he wants to start another process?)? He won't have a webinterface on that session!
Then you can put the binary in /usr/sbin (which is also acceptable), chown it to tss2:tss2, and chmod 710/770 it. Regarding "working directory", is it enough to set the home directory of user "tss2" to /usr/share/tss2, and then having the daemon change user to tss2 will automatically make the working directory his home directory? Or must there be an explicit "cd /usr/share/tss2" prior to running the daemon?
Originally posted by Echo
Then you can put the binary in /usr/sbin (which is also acceptable), chown it to tss2:tss2, and chmod 710/770 it. Regarding "working directory", is it enough to set the home directory of user "tss2" to /usr/share/tss2, and then having the daemon change user to tss2 will automatically make the working directory his home directory? Or must there be an explicit "cd /usr/share/tss2" prior to running the daemon?
Maybe that's a stupid idea, but it should work and looks better than the things i've heard before:
What about putting a script into /usr/sbin instead of the binary itself? We could put the binary into /usr/share/tss2 too. If anyone starts the script (if he has the rights to use the start-stop-daemon), the working-directory will automatically be set to /usr/share
I'm not sure, if the working-directory is set automatically, if changing user. But it hasn't any negative causes, if we cd before, so why shouldn't i do that?
ScratchMonkey
11-09-2002, 03:17
The script idea is interesting. Mozilla and Netscape do that. They put a script in (eg.) /usr/bin/mozilla and it launches a binary in /usr/lib/mozilla-1.1. Take a look at those scripts for ideas.
Note that files in /usr/share are intended to be shared across machines of multiple architectures, so architecture-specific binaries are discouraged. Also, /usr/share may be a partition mounted with execution disallowed as a security measure.
Changing to a user does not set the working directory, unless you use the "-l" option to su, which simulates a full login. An explicit cd will make it more clear what's going on.
It's a very interesting dilemma. Put the executable in a reasonable location and screw httpdocs, or put it in an obscure area to enable the web-interface. Personally, I don't use the web-interface (another open port), so fuck it. :)
The script idea sounds like a reasonable compromise until the developers give us an option for -httpdocs elsewhere. Keep in mind that this script file is what start-stop-daemon will be running (if I follow you correctly).
Basically,
/etc/init.d/tss2 start does the following:
(within tss2) start-stop-daemon --start myScript
(within myScript) cd /funky/location/of/server_linux
(within myScript) ./server_linux
However, will this still work with start-stop-daemon's tracking of PID files, with it's --stop (it will kill myScript, not server_linux) and other functionality? Interesting question. Better answer, fuck the web-interface, and go standard. :)
Thanks for investing the time to create this .deb. Here is a problem I found:
The tss init.d script has DB=/etc/tss/server.db however, upon first staring the server via the init.d script, server.db was in /usr/local/tss. This was no big suprise, really, as my tests have proved the same. The DB parameter doesn't seem to work at all. This appears to be a bug with TS, not your package.
Great Work! Now can you make one for Red Hat 7.3 ? I just want to set TSS2 to run on boot.
ScratchMonkey
17-11-2002, 19:51
I have RPM's (source and binary) for the latest TSS2 server at http://matureasskickers.net/ftp/TeamSpeak/ts2/. The binary is for Red Hat 8. If you need one for 7.2, you'll need to rebuild from the source RPM. There's a nice HOWTO for that at http://www.rpm.org/hintskinks/buildtree/. Mike Harris's README there is a good start.
Hey Sidious, I've been out of the TS2 loop for a while, but I've been updating with each new client/server release.
Have you been updating the .deb you wrote with the new binaries? I've got a friend who'd like to make as seamless of an installation as possible. Also, is the server.db problem fixed in the .deb?
ScratchMonkey
10-12-2002, 18:53
I just found out about the new Linux release and will be cutting new RPM's shortly.
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.