Results 1 to 15 of 160
Thread: Linux server startup script!
-
21-12-2009, 04:49 #1
-= TeamSpeak Addict =-
- Join Date
- Dec 2009
- Location
- Bergen, Norway
- Posts
- 118
Linux server startup script!
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
Startup script for starting at boot
*Changelog*
Also made a menu based script that installs teamspeak to chosen folder, helps you make the ini files (mysql and server.ini), helps you configure and place the startscript.
The script will see if the files it creates already is there, if so it creates a backup of the old files. (scripts not install)
The ts3conf script, will also let you chose if you want to use screen mode or nohup mode.
Menu based script can be found at http://www.spagettimafia.com/ts3.
To download:To start:Code:wget http://www.spagettimafia.com/ts3/ts3conf
Screen shots at bottom of this post.Code:chmod +x ts3conf ./ts3conf
v 0.42 ts3conf: Minor change
Added feature, now cancel button on pages will get you back to main menu
Minor correction to the "export LD_LIBRARY_PATH", forgot to backslash a variable, nof fixed.
Removed the menu option "Userscript", no longer needed since TS Team have provided us with one!
v 0.41 ts3conf: Minor change.
Removed the reccomandation for using screen over NOHUP methode, due to devs fixing it in newer version of server binary.
On Ubuntu there have been some problems with the script when one is trying to use screen methode after they implemented the EXPORT librarypath statment. Please use NOHUP on that os.
v 0.95 Startscript: Minor change.
Bugfix, see v 0.42 changelog.
Also made the NOHUP script the default script on this page now. Screen version is still availeble as a choice in the ts3conf.
v 0.94 Startscript: Minor change.
Due to some people having problems with licence, when they use the script (server exits due to all slots used, even with only one person on the server). Changed the kill command from "kill -9 $id" to "kill -TERM $id", and hope this solves that problem
v 0.93 Startscript & v0.4 ts3conf: Minor change
Added text to command that starts the server to fit the new LD_LIBRARY_PATH string
Changed the way ts3conf renames old ini/script files to name.dd_mm_yy__time.bck instead of name.dd mm yy time.bck.
v 0.92: Added test option so one can check if it is set up correctly.
v 0.9: Minor change.
Added statements that checks if screen, awk and sudo is installed. If not it will tell you
Also checks for ts3 binary file in case of a miss configuration.
v 0.8: Added features.
Now script can handle ts3server.ini.
Added function for logging, where default logfile is /var/log/ts3.log. Can be changed ofcourse in options section of script
v 0.7: Total rewrite of the script.
Script start command now does the following: Checks if the server is running and checks if there is a pid-file.
Case 1: If the server is not running and there is no pid-file. It starts the server and creates a pid-file.
Case 2: If the server is not running and there is an old pid-file, deletes the old pid-file, starts the server and creates a new pid-file.
Case 3: The server is running but no pid-file. The server does not start a new one but creates a pid-file for the already running server.
Case 4: The server is running and there is a pid-file. Returns text that says the server is running!
Script stop command now does the following: Checks if the server is running and if there is a pid-file.
Case 1: The server is not running and there is no pid-file. Returns text that tells you server is not running.
Case 2: The server is not running and there is a pid-file. Removes the old pid-file.
Case 3: The server is running but no pid-file. Creates a new pid-file so the server can be properly shut down and removes the pid-file again.
Case 4: The server is running and there is a pid-file. Stops the server and removes the pid-file.
v 0.6: script so it now works even if it is an powerfailure. It now checks if teamspeak is running. If it is not it deletes the pid file and starts it normally!
This is a script that allows you to start TeamSpeak 3 at boot-up and it will close TeamSpeak 3 at reboot and shut-down. This script runs TeamSpeak 3 as another user than root as well for security reasons
!!This script requires that you have root access!!
Here is the script unmodified:
Guide for UBUNTUCode:#!/bin/sh #Teamspeak 3 NOHUP startup script v0.95 #Written by mancert ########################################################################################### # Remember to start the teamspeak server manually the first time so you get the # server admin password and the server admin token. # If you want to use mysql database, remember to create a ts3db_mysql.ini file # in the folder ts3 in installed in. And make sure ts3server.ini is set right. # Changelog @ http://forum.teamspeak.com/showthread.php?t=46989 # # The test start option will check if you are missing anything before you start the script # ########################################################################################### ############################ OPTIONS ###################################################### TITLE='Teamspeak 3 server' # Name for the server DAEMON='ts3server_linux_x86' # Server binary, here the 32bit TS3='/home/teamspeak/ts' # Path to ts3 binary USER='teamspeak' # User running server USERG='users' # Usergroup of user OPT='inifile=ts3server.ini' # inifile=server.inifile LOGFILE='/var/log/ts3.log' # Logfile location and file ############################ END OPTIONS ################################################## ########################### NO NEED TO EDIT UNDER HERE #################################### precheck () { # Checking for sudo if [ ! -x /usr/bin/sudo ]; then echo "" echo "You do not have Sudo installed. Please install it and try again." echo "$(date +"%b %a %d %H:%M:%S"): You do not have Sudo installed." >> $LOGFILE echo "" exit 1 fi # Checking for awk if [ ! -x /usr/bin/awk ]; then echo "" echo "You do not have Awk installed. Please install it and try again." echo "$(date +"%b %a %d %H:%M:%S"): You do not have awk installed." >> $LOGFILE echo "" exit 1 fi # Checking for ts3 binary if [ ! -x $TS3/$DAEMON ]; then echo "Can't find /" echo "Is the configs done right? Is installed?" echo "$(date +"%b %a %d %H:%M:%S"): Can't find /" >> $LOGFILE exit 1 fi echo echo "All seems fine, try /etc/init.d/ts3 start" echo } service_start() { TEST=$(ps ax | grep $DAEMON | grep -v export | grep -v grep | wc -l) # Server not running and no pid-file found if [ "$TEST" = "0" ] && [ ! -f $TS3/ts3.pid ]; then echo echo "Starting $TITLE" echo "$(date +"%b %a %d %H:%M:%S"): Starting $TITLE" >> $LOGFILE cd $TS3 LIBPATH=$(pwd) su $USER -c "export LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ; $TS3/$DAEMON $OPT" >> $LOGFILE 2>&1 & sleep 1 sudo -u $USER ps ax | grep -v grep | grep $DAEMON | grep -v export | awk '{print $1}' > $TS3/ts3.pid chown $USER:$USERG $TS3/ts3.pid echo "$TITLE screen process ID written to $TS3/ts3.pid" echo "$TITLE started." echo "$(date +"%b %a %d %H:%M:%S"): $TITLE started" >> $LOGFILE echo exit 1 fi # Server not running and a pid-file is found if [ "$TEST" = "0" ] && [ -f $TS3/ts3.pid ]; then echo echo "Server not running but pid-file present" echo "Removing pid-file" echo "$(date +"%b %a %d %H:%M:%S"): Server not running but pid-file present" >> $LOGFILE echo "$(date +"%b %a %d %H:%M:%S"): Removing pid-file" >> $LOGFILE rm $TS3/ts3.pid echo "Old pid file removed" echo "$(date +"%b %a %d %H:%M:%S"): Old pid file removed" >> $LOGFILE echo echo "Starting $TITLE" echo "$(date +"%b %a %d %H:%M:%S"): Starting $TITLE" >> $LOGFILE cd $TS3 LIBPATH=$(pwd) su $USER -c "export LD_LIBRARY_PATH=$LIBPATH:$LD_LIBRARY_PATH ; $TS3/$DAEMON $OPT" >> $LOGFILE 2>&1 & sleep 1 sudo -u $USER ps ax | grep -v grep | grep $DAEMON | grep -v export | grep -v export | awk '{print $1}' > $TS3/ts3.pid chown $USER:$USERG $TS3/ts3.pid echo "$TITLE screen process ID written to $TS3/ts3.pid" echo "$TITLE started." echo "$(date +"%b %a %d %H:%M:%S"): $TITLE started" >> $LOGFILE echo fi # Server running and no pid file-found, creates a new one! if [ "$TEST" = "1" ] && [ ! -f $TS3/ts3.pid ]; then echo echo "Server is running but no pid file. Creating a new pid file!!" echo "$(date +"%b %a %d %H:%M:%S"): Server is running but no pid file. Creating a new pid file!!" >> $LOGFILE sudo -u $USER ps ax | grep -v grep | grep $DAEMON | grep -v export | awk '{print $1'} > $TS3/ts3.pid chown $USER:$USERG $TS3/ts3.pid echo echo "$TITLE is running and new pid-file created" echo "$(date +"%b %a %d %H:%M:%S"): $TITLE is running and new pid-file created" >> $LOGFILE echo fi # Server running and pid-file found if [ "$TEST" = "1" ] && [ -f $TS3/ts3.pid ]; then echo echo "$TITLE is running!!" echo "$(date +"%b %a %d %H:%M:%S"): $TITLE is running!!" >> $LOGFILE echo fi } service_stop() { TEST1=$(ps ax | grep -v grep | grep $DAEMON | grep -v export | wc -l) # Server is not running and no pid-file found if [ "$TEST1" = "0" ] && [ ! -f $TS3/ts3.pid ]; then echo echo "$TITLE is not running!!" echo "$(date +"%b %a %d %H:%M:%S"): $TITLE is not running!!" >> $LOGFILE echo fi # Server is not running and pid-file found if [ "$TEST1" = "0" ] && [ -f $TS3/ts3.pid ]; then echo echo "Server is not running but pid-file is present" echo "Removing pid-file" echo "$(date +"%b %a %d %H:%M:%S"): Server is not running but pid-file is present" >> $LOGFILE echo "$(date +"%b %a %d %H:%M:%S"): Removing pid-file" >> $LOGFILE rm $TS3/ts3.pid echo echo "Pid file removed" echo "$(date +"%b %a %d %H:%M:%S"): Pid file removed" >> $LOGFILE echo fi # Server is running but no pid-file found if [ "$TEST1" = "1" ] && [ ! -f $TS3/ts3.pid ]; then echo echo "$TITLE is running but no pid file found." echo "Stopping $TITLE" echo "$(date +"%b %a %d %H:%M:%S"): $TITLE is running but no pid file found." >> $LOGFILE echo "$(date +"%b %a %d %H:%M:%S"): Stopping $TITLE" >> $LOGFILE sudo -u $USER ps ax | grep -v grep | grep $DAEMON | grep -v export | awk '{print $1'} > $TS3/$DAEMON.pid chown $USER:$USERG $TS3/ts3.pid for id in $(cat $TS3/ts3.pid) do kill -TERM $id echo "Killing process ID $id" echo "Removing $TITLE pid file" rm -rf $TS3/ts3.pid break done echo "$TITLE stopped" echo "$(date +"%b %a %d %H:%M:%S"): $TITLE stopped" >> $LOGFILE echo fi # Server running and pid-file found if [ "$TEST1" = "1" ] && [ -f $TS3/ts3.pid ]; then echo echo "Stopping $TITLE" echo "$(date +"%b %a %d %H:%M:%S"): Stopping $TITLE" >> $LOGFILE for id in $(cat $TS3/ts3.pid) do kill -TERM $id echo "Killing process ID $id" echo "Removing $TITLE pid file" rm -rf $TS3/ts3.pid break done echo "$TITLE stopped" echo "$(date +"%b %a %d %H:%M:%S"): $TITLE stopped" >> $LOGFILE echo fi } case "$1" in 'start') service_start ;; 'stop') service_stop ;; 'restart') service_stop sleep 1 service_start ;; 'test') precheck ;; *) echo "Usage ./ts3conf start|stop|restart|precheck" esac
Start a terminal and type this:
Then I did this in a terminal:Code:user@ubuntu-test:~$ sudo sh [sudo] password for user: # passwd Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully # exit
Some text.....Code:user@ubuntu-test:~$ su Password: root@ubuntu-test:/home/user# adduser teamspeak
Some more text....Code:Enter new UNIX password: Retype new UNIX password:
Paste the script into the editor you just opened, ctrl-x to quit and choose to save.Code:Is this information correct? [Y/n] y root@ubuntu-test:/home/user# su teamspeak teamspeak@ubuntu-test:/home/user$ cd teamspeak@ubuntu-test:~$ wget http://ftp.4players.de/pub/hosted/ts3/releases/beta-2/teamspeak3-server_linux-x86-3.0.0-beta2.tar.gz teamspeak@ubuntu-test:~$ tar zxvf teamspeak3-server_linux-x86-3.0.0-beta2.tar.gz teamspeak@ubuntu-test:~$ exit root@ubuntu-test:/home/user# cd /etc/init.d root@ubuntu-test:/etc/init.d# nano ts3
Then run these command:
Guide SLACKWARECode:root@ubuntu-test:/etc/init.d# chmod +x ts3 root@ubuntu-test:/etc/init.d# update-rc.d -f ts3 defaults
Log in as root and do the following:
Some text...Code:root@slack:/# adduser teamspeak
Some more text...Code:Enter new UNIX password: Retype new UNIX password:
Then paste the script into that file, press ctrl-X and choose yes to save.Code:Is this information correct? [Y/n] y root@slack:/# su teamspeak teamspeak@slack:/$ cd teamspeak@slack:~$ wget http://ftp.4players.de/pub/hosted/ts3/releases/beta-6/teamspeak3-server_linux-x86-3.0.0-beta6.tar.gz teamspeak@slack:~$ tar zxvf teamspeak3-server_linux-x86-3.0.0-beta6.tar.gz teamspeak@slack:~$ exit root@slack:/# cd /etc/init.d root@slack:etc/init.d/# nano ts3
We need to make the script executable:And last we need to edit rc.local and rc.local_shutdown:Code:root@slack:etc/init.d/# chmod +x ts3
Add the following in this file: /etc/init.d/ts3 startCode:root@slack:etc/init.d/# cd .. root@slack:etc/# cd rc.d root@slack:etc/rc.d/# nano rc.local
The rc.local_shutdown is not there so we need to make it:Add the following line: /etc/init.d/ts3 stopCode:root@slack:etc/rc.d/# nano rc.local_shutdown
Remember to start the server as the teamspeak user fiirst
So you will see this:
------------------------------------------------------------------
I M P O R T A N T
------------------------------------------------------------------
Server Query Admin Acccount created
loginname= "serveradmin", password= "VDWCmvI8"
------------------------------------------------------------------
....
2009-12-24 08:56:07.305563|WARNING |VirtualServer | 1| ServerAdmin token created, please use the line below
2009-12-24 08:56:07.306947|WARNING |VirtualServer | 1| token=jeSPHw6bOfH0x2TUCaIx6Me80l8+LgUZ1xz/WzPs
P.s.1.0
All passwords and tokens where created on a virtual server, so they do not exist!
P.s.1.1 More guids to come for other distributions as I download them. If any requests pm me!Last edited by dante696; 21-02-2011 at 12:24. Reason: 1. Minor change | 2. typo | 3. Added feature | 4. Minor change | 5. Big update
-
21-12-2009, 07:14 #2
-= TeamSpeak Lover =-
- Join Date
- Feb 2008
- Location
- Wisconsin
- Posts
- 54
Help a n00b
I am 1 day into Linux and hating it. All this permissions stuff is giving me a headache. Can you help a new guy out with a little more explanation as to where this file should go and what permissions/ownership it must have. Thanks!
Ubuntu was easy to setup, TS3 is easy to get running (basically), but I cant get it so that it restarts on server reboot. What you have scripted out here seems to be what I am looking for.
-
21-12-2009, 07:30 #3
-= TeamSpeak Lover =-
- Join Date
- Nov 2009
- Location
- United States
- Posts
- 40
Ok, so normally there is a start script, a restart script, and a stop script. Can you give some output to what those would all be? Great work on this though, I use webmin to control all my servers and this is how I control them.
-
21-12-2009, 07:31 #4
-= TeamSpeak Lover =-
- Join Date
- Dec 2009
- Location
- germany
- Posts
- 74
You have to create a cronjob for that.
I don't know exactly where you can edit your cronjobs under Ubuntu, but basically you should add a new file to the cronjob folder which is named like your teamspeak user.
For example if you named your teamspeak user tss, you should create a file called tss in the cronjob directory with the following content:
You should do a google search for where you can find your cronjob directory under Ubuntu.Code:@reboot /PATH_TO_YOUR_TS3_DIRECTORY/YOUR_TS3_STARTER_FILE
-
21-12-2009, 07:42 #5
-= TeamSpeak Addict =-
- Join Date
- Dec 2009
- Location
- Bergen, Norway
- Posts
- 118
The code goes into a file under /etc/init.d
Then you go into /etc/rc.d folder and edit rc.local file. There you add:
Also make a file called rc.local_shutdown in /etc/rc.d/ folder. In that file you add:Code:/etc/init.d/filname start
Try that!Code:/etc/init.d/filname stop
p.s. make sure there is no .pid file in teamspeak directory when you start the script since then it will not work!
p.s.2 this script creates a .pid file when it starts ts server and it removes the pid file when you stop the server via the script.
-
21-12-2009, 08:38 #6
-= TeamSpeak User =-
- Join Date
- Dec 2009
- Location
- AZ
- Posts
- 14
I ran into a problem creating the user teamspeak. I did this before you added the line:
chown $USER:$USERG $TS3/$NAME-screen.pid
But seems to me a user is still needed.
I am using debain and I used:
sudo useradd teamspeak
But when I went to run it I ran into problems about passwords. not sure if it wanted my user password or a password for user teamspeak which I didn't make.
Also the logs show that /home/teamspeak was created but it wasn't
Code:Dec 21 01:02:21 x64VDR sudo: vorg : TTY=pts/2 ; PWD=/usr/local/src/TeamSpeak ; USER=root ; COMMAND=/usr/sbin/useradd teamspeak Dec 21 01:02:21 x64VDR useradd[2153]: new group: name=teamspeak, GID=1001 Dec 21 01:02:21 x64VDR useradd[2153]: new user: name=teamspeak, UID=1001, GID=1001, home=/home/teamspeak, shell=/bin/sh Dec 21 01:04:33 x64VDR su[2162]: pam_unix(su:auth): authentication failure; logname=vorg uid=1000 euid=0 tty=pts/2 ruser=vorg rhost= user=teamspeak Dec 21 01:04:35 x64VDR su[2162]: pam_authenticate: Authentication failure Dec 21 01:04:35 x64VDR su[2162]: FAILED su for teamspeak by vorg Dec 21 01:04:35 x64VDR su[2162]: - pts/2 vorg:teamspeak Dec 21 01:04:43 x64VDR su[2166]: pam_unix(su:auth): authentication failure; logname=vorg uid=1000 euid=0 tty=pts/2 ruser=vorg rhost= user=teamspeak Dec 21 01:04:44 x64VDR su[2166]: pam_authenticate: Authentication failure Dec 21 01:04:44 x64VDR su[2166]: FAILED su for teamspeak by vorg Dec 21 01:04:44 x64VDR su[2166]: - pts/2 vorg:teamspeak
-
21-12-2009, 09:14 #7
-= TeamSpeak Addict =-
- Join Date
- Dec 2009
- Location
- Bergen, Norway
- Posts
- 118
My script requires that you have the a user added for it to work atm. This is what I did:
This is how i created the user:
After lots of pressing enter and password for that account set I did this:Code:root@teamspeak:/# adduser teamspeak
Then you can run the script from the folder you're distro has as an init folder.Code:root@teamspeak:/# su teamspeak teamspeak@teamspeak:$ wget http://ftp.4players.de/pub/hosted/ts3/releases/beta-2/teamspeak3-server_linux-x86-3.0.0-beta2.tar.gz teamspeak@teamspeak:/$ tar zxvf teamspeak3-server_linux-x86-3.0.0-beta2.tar.gz teamspeak@teamspeak:/$ exit
The reason I did it this way is that i will not have to worry so much about folder rights since the teamspeak server is run with teamspeak user from teamspeak home folder.
did that clarify anything or did it make it worse?
mancert
-
21-12-2009, 09:35 #8
-= TeamSpeak User =-
- Join Date
- Dec 2009
- Location
- AZ
- Posts
- 14
well, I see part of the problem. some root commands can't be done with sudo. you have to do su to switch to root user first. did that and it created the teamspeak home folder. so that's a start.
I think for "su $USER" you can include the password in the USER var and then you won't need to enter the password. But it still would have to be set. have to experment but it's 2:35am and I don't know linux that well when I'm awake.
-
21-12-2009, 12:05 #9
-= TeamSpeak Addict =-
- Join Date
- Dec 2009
- Location
- Bergen, Norway
- Posts
- 118
I've installed ubuntu on a virtual machine and had a go with this script.
And here is what I did to make the server start at bootup and stop on halt and reboot.
first of all I set a root password since ubuntu did not give me the option to do that when I installed the distro.
Start a terminal and type this:
Then I did this in a terminal:Code:user@ubuntu-test:~$ sudo sh [sudo] password for user: # passwd Enter new UNIX password: Retype new UNIX password: passwd: password updated successfully # exit
Some text.....Code:user@ubuntu-test:~$ su Password: root@ubuntu-test:/home/user# adduser teamspeak
Some more text....Code:Enter new UNIX password: Retype new UNIX password:
Paste the script into the editor you just opened, ctrl-x to quit and choose to save.Code:Is this information correct? [Y/n] y root@ubuntu-test:/home/user# su teamspeak teamspeak@ubuntu-test:/home/user$ cd teamspeak@ubuntu-test:~$ wget http://ftp.4players.de/pub/hosted/ts3/releases/beta-2/teamspeak3-server_linux-x86-3.0.0-beta2.tar.gz teamspeak@ubuntu-test:~$ tar zxvf teamspeak3-server_linux-x86-3.0.0-beta2.tar.gz teamspeak@ubuntu-test:~$ exit root@ubuntu-test:/home/user# cd /etc/init.d root@ubuntu-test:/etc/init.d# nano ts3
Then run these command:
Then Teamspeak 3 will start and stop correctly when server starts, reboots or halts.Code:root@ubuntu-test:/etc/init.d# chmod +x ts3 root@ubuntu-test:/etc/init.d# update-rc.d -f ts3 defaults
-
21-12-2009, 13:40 #10
-= TeamSpeak User =-
- Join Date
- Dec 2009
- Location
- somewhere
- Posts
- 22
Thnx mancert for making this script !
-
21-12-2009, 16:03 #11
-= TeamSpeak User =-
- Join Date
- Dec 2009
- Location
- somewhere
- Posts
- 22
Changed one line to load the ts3server.ini file.
su $USER -c "$INTERFACE $TS3/$DAEMON inifile=ts3server.ini"
(ts3db_mysql.ini is loaded automatically because mysql is enabled instead of sqlite3 in the ts3server.ini)
-
21-12-2009, 16:20 #12
-= TeamSpeak User =-
- Join Date
- Dec 2009
- Location
- Germany
- Posts
- 27
For this people who need more option in the startscript could look hier:
http://forum.teamspeak.com/showthread.php?t=47075
You could edit all startvaribles, to the end both script, this and my, do the self. The Server start
-
21-12-2009, 21:09 #13speeker Guest
Thanks for script mancert!
It is starting/stopping server just fine.
But I cannot use screen to get into the $NAME screen.
When I manually type in prompt the "screen -A -m -d -S teamspeak3" it creates the screen.
I can rejoin teamspeak3 with screen -d -r teamspeak3, and then exit it back to root.
But with ./teamspeak3 start the screen doesn't show up in the screen -ls or -list to rejoin it to see the server.
Any ideas?
Fedora10.Last edited by speeker; 21-12-2009 at 22:07.
-
21-12-2009, 21:52 #14
-= TeamSpeak User =-
- Join Date
- Feb 2005
- Location
- Germany
- Posts
- 5
@ mancert
Big Thnx for the script,
This script start TS3 with MYSQL
tested under Debian 5
Code:#!/bin/sh #Teamspeak 3 MySQL startup script #Server options TITLE='Teamspeak 3 MySQL Server' NAME='ts3' # Name for screen session DAEMON='ts3server_linux_x86' # Server binary, here the 32bit TS3='/home/teamspeak/teamspeak3-server_linux-x86' # Path to ts3 binary USER='teamspeak' # User running server USERG='users' # Usergroup of user #Screen command INTERFACE="/usr/bin/screen -A -m -d -S $NAME" ### NO NEED TO EDIT UNDER HERE ### service_start() { if [ ! -f $TS3/$NAME-screen.pid ]; then if [ -x $TS3/$DAEMON ]; then echo "Starting $TITLE" cd $TS3 su $USER -c "$INTERFACE $TS3/$DAEMON dbplugin=ts3db_mysql" sleep 1 sudo -u $USER ps -ef | grep -v grep | grep SCREEN | grep $NAME | awk '{print $2}' > $TS3/$NAME-screen.pid chown $USER:$USERG $TS3/$NAME-screen.pid echo "$TITLE screen process ID written to $TS3/$NAME-screen.pid" echo "$TITLE started." fi else echo -e "Can't start $TITLE. Server is already running." #exit 1 fi } service_stop() { if [ -f $TS3/$NAME-screen.pid ]; then echo "Stopping $TITLE" # Get the process ID from the pid file we created earlier for id in `cat $TS3/$NAME-screen.pid` do kill -9 $id echo "Killing process ID $id" echo "Removing $TITLE screen pid file" rm -rf $TS3/$NAME-screen.pid break done # Wipe all old screen sessions su $USER -c "screen -wipe 1> /dev/null 2> /dev/null" echo "$TITLE stopped" else echo -e "Cannot stop $TITLE. Server is not running." #exit 1 fi } case "$1" in 'start') service_start ;; 'stop') service_stop ;; 'restart') service_stop sleep 1 service_start ;; *) echo "Usage $0 start|stop|restart" esac
-
21-12-2009, 21:58 #15
-= TeamSpeak Addict =-
- Join Date
- Dec 2009
- Location
- Bergen, Norway
- Posts
- 118
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Jdawgg's Guid to Starting a TeamSpeak 2 SERVER
By JD in forum [TeamSpeak 2] Server SupportReplies: 21Last Post: 14-08-2008, 14:54 -
Server Issue's When PC Reboots
By gokub27 in forum [TeamSpeak 2] Client SupportReplies: 3Last Post: 14-09-2006, 21:32 -
server on freeBSD 5.3
By Dulithol in forum [TeamSpeak 2] Server SupportReplies: 0Last Post: 01-02-2005, 21:36 -
disconnection
By Barmace in forum [TeamSpeak 2] Server SupportReplies: 8Last Post: 10-10-2004, 19:23 -
Running TS1 on a linux server
By Taipan in forum [TeamSpeak Classic] General QuestionsReplies: 8Last Post: 04-11-2003, 08:31


Reply With Quote
. But one question, does this script start TS3 at boot up and shut it down on reboot/halt?