Anonymous Guest
|
Posted: Tue Aug 09, 2005 2:24 am Post subject: Ices Stop PHP Script |
|
|
Code: |
<?php
/********************************************************/
/* Version .03 */
/* William J. Galway */
/* http://www.galwayland.com */
/* */
/* .03 Released 8-Aug-2005 */
/* Changed exec("ps -A | grep ices | cut -c 0-6") */
/* to exec("ps -o \"%p\" --noheaders -C ices") */
/* Thanks Jens.. */
/* */
/* .02 Released 21-Jul-2005 */
/* ------------------------ */
/* Cleaned up code. */
/* */
/* .01 Initial Release 18-Jul-2005 */
/* ------------------------------- */
/* */
/********************************************************/
/*--------------*/
/* Header */
/*--------------*/
header("Cache-Control: no-store, no-cache");
error_reporting(E_ALL);
echo "<a href=\"http://www.galwayland.com/admin.php?op=IcecastAdmin\">Return to Icecast Admin</a><br><br>";
$date = date("l dS of F Y h:i:s A");
echo "$date<br>";
/*----------------------*/
/* Stopping Ices */
/*----------------------*/
echo "---------------------------------------------<br>";
$pid = exec("ps -o \"%p\" --noheaders -C ices");
if ($pid >=1) {
echo "Ices Running On PID $pid <br>";
echo "Sending SIGINT to Stop Ices<br>";
echo "kill -s INT $pid <br>";
echo exec("kill -s INT $pid 2>&1 ", $out, $error);
sleep (3);
}
echo "<br>";
echo "---------------------------------------------<br>";
/*******************/
/* Checking Status */
/*******************/
echo "<br><br>";
echo "--------------------<br>";
echo "---Ices Status---<br>";
echo "--------------------<br>";
$pid2 = exec("ps -o \"%p\" --noheaders -C ices");
if ($pid2 <=1) {
echo "Ices Stopped";
}
else {
echo "Ices Failed To Stop<br>";
echo "Please Try Again..<br>";
}
?>
|
|
|