Results 1 to 8 of 8
-
12-05-2012, 17:56 #1
-= TeamSpeak Addict =-
- Join Date
- Jun 2011
- Location
- Russian Federation
- Posts
- 208
Restart script (when server crashed)
guys, I'm sorry if the topic has already been raised to me, I just need a clear and distinct answer. The additions are many scripts that prevent auto-crash the server. I personally need the simple, high-quality, reliable, and of course hard-working. Just a lot of them do not know what to choose.
On the advice of a good script auto-crash server some sort
Sincerely, Arthur
-
12-05-2012, 18:30 #2
Hey,
I have running a script like this one:
https://gist.github.com/2667773
-
12-05-2012, 20:18 #3
-= TeamSpeak Addict =-
- Join Date
- Jun 2011
- Location
- Russian Federation
- Posts
- 208
Thank you for having responded to me.
At a very simple form that pleases, I would like to clarify, I'm changing it up just the way my server and score it in the crontab
Do I understand you?
example:
crontabCode:#!/bin/sh # Automatically restarts a TeamSpeak3 Server once it has crashed. # Required init.d integration of the Server # Author : Maximilian Narr # Homepage : devmx.de # eMail : maxe.nr@live.de # Adapt it to your path where the TS3 Server is located. cd /home/tsserver/server if [ -e ts3server.pid ] then if ( !(kill -0 $(cat ts3server.pid) 2> /dev/null) ) then # Start command sh /home/tsserver/ts3server_startscript.sh restart fi else # Start command sh /home/tsserver/ts3server_startscript.sh restart fi
And here's another question, whether the server is run teamspeak automatically after you reboot the server machine? or the script is only responsible for auto-crash server?Code:*/1 * * * * cd /scripts/crash.sh or */1 * * * * cd ~/scripts && sh crash.sh
-
13-05-2012, 09:37 #4Yep, you simply have to adapt the paths to the directory where your server is located.Thank you for having responded to me.
At a very simple form that pleases, I would like to clarify, I'm changing it up just the way my server and score it in the crontab
Do I understand you?
In the crontab
should be enough.Code:*/1 * * * * sh /path/to/your/file/crash.sh
The script is ONLY for autorestarting the server, it does not automatically start it on boot. Therefore you have make an init.d integration and link it then to rc2.d resp. rc0.d.
This is my script for that: https://gist.github.com/2686934
1. Create the file teamspeak in /etc/init.d:
Copy the code from the above link and edit it that it fits with your configurationCode:nano /etc/init.d/teamspeak
2. Now you can control the TeamSpeak3 Server like that:
3. Link the file to rc0.d directory to automatically stop the server on shutdown and to rc2.d directory to start the server automatically on startup. Also you might add it to rc6.d to start the server on reboot.Code:# Start the server /etc/init.d/teamspeak start # Stop the server /etc/init.d/teamspeak stop # Restart the server /etc/init.d/teamspeak restart # Get status of the server /etc/init.d/teamspeak status
Code:cd /etc/rc0.d # Adapt the number to a lower value for higher priority sudo ln -s /etc/init.d/teamspeak K50teamspeak
Code:cd /etc/rc2.d # Adapt the number to a lower value for higher priority sudo ln -s /etc/init.d/teamspeak S50teamspeak
4. Now you got it, and the server should automatically restart on startup. In the first script you can now also use it this way:Code:cd /etc/rc6.d # Adapt the number to a lower value for higher priority sudo ln -s /etc/init.d/teamspeak S50teamspeak
I hope this helpsCode:#!/bin/sh # Automatically restarts a TeamSpeak3 Server once it has crashed. # Required init.d integration of the Server # Author : Maximilian Narr # Homepage : devmx.de # eMail : maxe.nr@live.de # Adapt it to your path where the TS3 Server is located. cd /home/tsserver/server if [ -e ts3server.pid ] then if ( !(kill -0 $(cat ts3server.pid) 2> /dev/null) ) then # Start command /etc/init.d/teamspeak restart fi else # Start command /etc/init.d/teamspeak restart fi
Last edited by Maxe___; 06-07-2012 at 20:30.
-
14-05-2012, 13:39 #5
-= TeamSpeak Addict =-
- Join Date
- Jun 2011
- Location
- Russian Federation
- Posts
- 208
Thank you very much. everything works well!!
-
14-05-2012, 18:14 #6
-
16-05-2012, 16:34 #7
-= TeamSpeak Addict =-
- Join Date
- Jun 2011
- Location
- Russian Federation
- Posts
- 208
Topic can be closed. Oche useful for those who are not identified with the choice of a script.
-
04-07-2012, 07:30 #8
-= TeamSpeak User =-
- Join Date
- Jul 2007
- Location
- Germany
- Posts
- 14
teamspeak file
PHP Code:#!/bin/bash
### BEGIN INIT INFO
# Provides: teamspeak
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start TeamSpeak3 Server
# Description: Start the TeamSpeak3 Server
### END INIT INFO
### Start adaptable information ###
# User which will run the Teamspeak-Server
USER=ts3
# The installation directory of the Teamspeak-Server
DIR=/home/ts3/
### End adaptable information ###
if [ $1 == "start" ]; then
# Be sure to specify additional starting parameters here
su -c "cd $DIR && $DIR/ts3server_startscript.sh start" - $USER
elif [ $1 == "restart" ]; then
su -c "cd $DIR && $DIR/ts3server_startscript.sh stop" - $USER
# Be sure to specify additional starting parameters here
su -c "cd $DIR && $DIR/ts3server_startscript.sh start" - $USER
else
su -c "cd $DIR && $DIR/ts3server_startscript.sh $1" - $USER
fi
I did all like from Step 1 to 3. The Commands likeworks fine, but when i restart the Server, Teamspeak is not restarting...PHP Code:/etc/init.d/teamspeak start
Can someone help me?
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
Server crashed, now I can't restart Teamspeak3
By ggalloway in forum Linux / FreeBSDReplies: 3Last Post: 04-02-2012, 22:49 -
Ts Restart Script
By Mr.Pink in forum [TeamSpeak 2] Server SupportReplies: 0Last Post: 01-06-2006, 13:38 -
TS restart script.
By Mr.Pink in forum [TeamSpeak 2] Server SupportReplies: 0Last Post: 27-04-2006, 17:25 -
TS Restart Script
By uRph03n1x in forum [TeamSpeak 2] Server SupportReplies: 11Last Post: 07-02-2006, 12:53 -
virtual server restart script
By Khundawg in forum [TeamSpeak 2] Addons & ScriptsReplies: 8Last Post: 29-11-2005, 19:25


Reply With Quote
