Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TeamSpeak Restart

Posted on 2014-01-31
1
Medium Priority
?
587 Views
Last Modified: 2014-02-11
I'm looking for a way to run SSH commands via a PHP file and stop and restart my Teamspeak server.  I want this for some of my staff to be able to restart the server that cannot use SSH.

Is there a way to do this?

When they click the link it would need to run this command:

./ts3server_startscript.sh stop

Open in new window


Then delay about 10 seconds.

Then run this command:
./ts3server_startscript.sh start inifile=ts3server.ini

Open in new window


The location of the start script is /home/starcit/ts/teamspeak3-server_linux-amd64
0
Comment
Question by:Nathan Riley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 35

Accepted Solution

by:
gr8gonzo earned 2000 total points
ID: 39824609
I would say the "safest" way to do this is to create a PHP file that has a form and a button on it. When they click the button, the PHP script simply creates a file in /tmp called "restart_teamspeak.flag", like this:

<?php
if(isset($_POST["restart_teamspeak"]))
{
   file_put_contents("/tmp/restart_teamspeak.flag","");
   echo "Starting the restart process. This may take up to a minute.";
}
else
{
  echo "<form action='".basename(__FILE__)."' method='post'><input type='submit' value='Restart Teamspeak'></form>";
}

Open in new window


...then create a shell script that checks for the existence of the file and simply runs those commands if it finds /tmp/restart_teamspeak.flag and then deletes the file after it's done.

Finally, create a cron job that runs that shell script every minute.

This should give you a safe way to kick off that process via a web server.

You CAN alternatively set up a web server with enough permissions to run the commands directly, but this typically means that it will have enough permissions to do other things, as well, which creates a huge vulnerability.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question