View Full Version : My modified Start-up script
It is not very good idea to run TS server with root priviledges cos of security holes this nice software might have.
I modified server start-up script to run server with user account made only for this use.
1. adduser tss
--> creates new user named tss
2. unpack & move server files to /home/tss directory
3. copy paste lines below in file and name it "tss.sh"
4. make tss.sh script executable -> chmod 755 tss.sh
#! /bin/bash
# Copyright (c) 2001 TeamSpeak team All rights reserved.
#
# Author: Niels Werensteijn 2001
#
# /etc/init.d/tss.sh
#
### BEGIN INIT INFO
# Provides: tss
# Required-Start: $network
# Required-Stop:
# Default-Start: 3 5
# Default-Stop:
# Description: TeamSpeakServer
### END INIT INFO
cd /home/tss
if [ "$UID" = "0" ]; then
exec "su" - tss -c "/home/tss/tss.sh $1"
fi
case "$1" in
start)
echo Starting TeamSpeak 2 Server Daemon
/home/tss/server_linux -PID=/home/tss/tss2.pid > /dev/null
;;
stop)
echo Stopping TeamSpeak Sercer Daemon
# kill -TERM `cat /home/tss/tss2.pid`
killall -9 server_linux
;;
restart)
$0 stop && $0 start
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac
exit 0
R. Ludwig
27-08-2002, 15:19
# kill -TERM `cat /home/tss/tss2.pid`
killall -9 server_linux
if u do that, channel settings are not stored.
Easy fix to that Ludwig:
echo Stopping TeamSpeak Sercer Daemon
kill -TERM `cat /home/tss/tss2.pid`
sleep 3
killall -9 server_linux
If you do it like above, you'll properly kill the teamspeak2 engine and safe the settings you want saving. After that leave 3 secs for the server to go down and then brutaly slap the rest of the webengine down :D
R. Ludwig
27-08-2002, 16:18
thats fine :P
Now that I've got you attention anyways...
'--DB=' is a valid flag to pass on server_linux to redirect it to a server.db located in a different place then the tss2 directory?
I have my programs in /usr/local/tss2
and I want my ini/db/log in /var/log/tss2
?!
ScratchMonkey
27-08-2002, 16:29
Following FHS and LSB guidelines, the INI file should probably be in /etc, DB in /var/lib/misc, and log in /var/log.
Sorry to say, but that wasn't my question... is '-DB' the correct switch to use for placing the server.db in another location?
Cause when I do so it tries to use the server.db from another location, where I put it, but it leaves me with a useless server cause it will not authenticate me.
First I need to check that and then I can place it in any directory structure I like.. most of my databases are under /var/lib btw.. just like mysql, dhcpd etc..
ScratchMonkey
27-08-2002, 16:45
Sorry, I was just addressing the part I know about. I'm not one of the coders, so I don't actually know anything about the DB option. I'm in the process of creating an RPM, so I'm watching this thread with interest!
Originally posted by R. Ludwig
# kill -TERM `cat /home/tss/tss2.pid`
killall -9 server_linux
if u do that, channel settings are not stored.
oh, this explains aswell why those settings do not stay in reboot either...thx for info :D
ScratchMonkey
27-08-2002, 16:59
"kill -9" should always be used as a last resort.
BTW, anyone plan to run on Solaris? If so, don't use killall. It has a totally different function on Solaris that's more dangerous. (I haven't encountered this personally, but I've read posts on newsgroups and mailing lists from plenty of people who have.)
When invoking an external binary from a script, always use the full path. Or explicitly set your path at the top of the script. Too many admins get trojaned by some user leaving a malicious program in his home directory named "ls" or other common utility. (That's why you shouldn't have "." in your path.)
R. Ludwig
27-08-2002, 18:09
-db=
-pid=
-ini=
-log=
that are all valid
ScratchMonkey
27-08-2002, 18:47
Feature request: -HTML=, to find the httpdocs directory. I want to put that in /usr/share/tss2/httpdocs, and have the program find it using the command line option. (Most Linux programs with "skinnable" GUI's keep that kind of thing in /usr/share.)
Originally posted by R. Ludwig
-db=
-pid=
-ini=
-log=
that are all valid
Hello
i tried a bit with all the parameters and sorry to say, but -DB is def. not working. My server will only recognises the server.db file.
the others work just fine.
Tupsi
I used -DB= in my start scripts and it works kinda. If I am to reboot the box -DB=/path/to /my/db works and it recognizes and uses the correct db. If I restart the process via the script it will not use the correct db unless I use this (exactly as typed)
-DB=/tsserver.db and it does find -DB=/path/to /my/db. If I reboot with -DB=/tsserver.db it of course looks for the .db on /
Go figure...
So what I've done is made a boot time script and a restart script and it seems to be fine. This is on RH 6.2 on an old router/NAT box. I'm not sure if the old ver of RH is causing this or not but this is what I have to do :(
ScratchMonkey
29-08-2002, 03:25
You're keeping the DB file in the root directory? Why?
I'm keeping mine in /etc/tss2/server.db.
shouldn't it be:
program in: /usr/local/tss2/server_linux
ini in: /usr/local/etc/tss2/server.ini OR /etc/tss2/server.ini
log in: /var/log/tss2/server.log
db in : /var/lib/tss2/server.db
pid in: /var/run/tsserver2.pid
? That would be a kind of official linux layout.
ScratchMonkey
29-08-2002, 16:45
I was addressing PanterA. I couldn't figure out what he was saying was happening.
Originally posted by ScratchMonkey
"kill -9" should always be used as a last resort.
BTW, anyone plan to run on Solaris? If so, don't use killall. It has a totally different function on Solaris that's more dangerous.
Yeah, the killall for solaris is a different beast than the one under linux. It is used by shutdown(1M) to kill ALL processes... not ones you specify... but ALL of 'em.
- AK
vBulletin® v3.7.3, Copyright ©2000-2009, Jelsoft Enterprises Ltd.