Restart your Teamspeak on a Crash

This script should work on any standard linux system.

To use this script simply open your favourite editor pico or vi or nano will do just fine and then paste the contents into 

TEAMSPEAK=`ps ax | grep ts3server_linux_amd64 | grep -v grep | wc -l`

if [ $TEAMSPEAK -eq 1 ]
cd /home/teamspeak/ts3 ; ./ start
There are several ways to place this into your cron. You can simply type:
su teamspeak

This will log you in as teamspeak and allow you to make a cron job

crontab -e 

To open your crontab and add it manually. Problem with doing this is not everyone knows vi and by default unless you change your environment vi is chosen. So what we will do here is list what you have in your cronjob currently by typing:

crontab -l

This will give us all current cronjobs. If you have none simply go to creating a ts.cron file. If you have stuff already in your cron I suggest you copy that and place it into your ts.cron file as well so you will not lose your current cronjobs. Now to create your ts.cron file simply open up your favorite editor and add the following line to the ts.cron file.

*/5 * * * * sh /home/teamspeak/

This cronjob will run every 5 minutes of every day. Simply change the 5 to the amount of minutes you would like it to run. I will not go into detail on cronjobs and how often to run a script but there are helpful tutorials for cronjobs all over the web. Google one up!

Now we need to insert our new ts.cron file into crontab. To do this simply type:

crontab ts.cron

From the files location and you should be all set.

If you are wanting to run this script as a ./ file then you will need to CHMOD the files permission

chmod +x 
  • 1 Users Found This Useful
Was this answer helpful?