Team Speak 3 Cron Job/Auto Restart

Started by {FWE}Ontime-Adm, February 24, 2011, 08:26:49 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

{FWE}Ontime-Adm

Team Speak 3 "Cron Job/Auto Restart" Does your Team Speak 3 crash and you need a auto restart through a "Cron job"here  is a couple scripts and simple instructions to auto restart your Team speak 3 through your host if they allow Cron Jobs.

Stepes 1. and 2. are the Scipts that your "Cron job" will EXACUTE to restart your server,you will only need one of these scripts step 1. "will not" spam your email.step 2. "will spam" your email

1. Here is a script you will need to copy and save as  "ts3restart.sh" Then copy the file to your Team speak 3 root directory.
Note this script will "not spam" your emails when ever your "Cron job" probes your server


#! /bin/bash
SERVICE='ts3server_linux'
if ps -a | grep -v grep | grep $SERVICE > /dev/null
then
echo "everything is cool"
else
echo "Teamspeak down! Call for backup!" |
sh -c "    (MY TS3 DIECTORY HERE)    ; ./ts3server_startscript.sh start
>/dev/null
2>&1 &"
if ps -a | grep -v grep | grep $SERVICE > /dev/null
then
echo
else
echo
fi
fi 



2. here is a script you will need to copy and save as  "ts3restart.sh"
Note this script "will  spam" your emails when ever your "Cron job" probes your server.

#! /bin/bash
SERVICE='ts3server_linux'
if ps -a | grep -v grep | grep $SERVICE > /dev/null
then
echo "everything is cool"
else
echo "Teamspeak down! Call for backup!" | mail -s "Teamspeak down" (MY EMAIL HERE.com)
sh -c "  (MY TS3 DIECTORY HERE) ; ./ts3server_startscript.sh start
>/dev/null
2>&1 &"
if ps -a | grep -v grep | grep $SERVICE > /dev/null
then
echo "Teamspeak is up" | mail -s "Teamspeak is up" (MY EMAIL HERE.com)
else
echo "Teamspeak is still down!" | mail -s "Teamspeak is still down"     (MY EMAIL HERE.com)
fi
fi


Now For The "Cron Job"
You will need to access your control panel where you host your "Team Speak 3" then you will need to find "Cron Job" section in your host, and setup a New Cron Job

1. If you want to know the status of your new Cron Job,every time your Cron Job runs For "Example you set your Cron Job to run every 5 min" YOU WILL GET 5 EMAILS every 5 minuites in a 24 hour period do the math "spam city" lol Use step 2 above. and set up your email in your Cron Job.

2. If you don't want  to be spammed to death by emails  from your  Cron Job, Do not set your email up in your Cron Job,and use step 1 above.

Cron Job "Command" copy and paste then add your path.

cd $HOME/teamspeak3-server_linux-amd64;./ts3restart.sh

you will also need to setup your time you want  your Cron job to execute the ts3restart.sh



{FWE}Ontime-Adm

#1
Be sure you are shutting your Team Speak 3 down with a program like ( PUTTY ) and not a remote admin program, when you are testing the script.shutting it down with a remote program does not give the same effect as a crash.