Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Icecast2 PHP Stop Script

 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server
View previous topic :: View next topic  
Author Message
Anonymous
Guest





PostPosted: Tue Aug 09, 2005 2:27 am    Post subject: Icecast2 PHP Stop Script Reply with quote

Code:

<?php

/********************************************************/
/* Version .03                                          */
/* William J. Galway                                    */
/* http://www.galwayland.com                            */
/*                                                      */
/* .03 Released 8-Aug-2005                              */
/*  Changed exec("ps -A | grep icecast | cut -c 0-6")   */
/*  to exec("ps -o \"%p\" --noheaders -C icecast")      */
/*  Thanks Jens..                                       */
/*                                                      */
/* .02 Released 21-Jul-2005                             */
/* ------------------------                             */
/* Cleaned up code.                                     */
/*                                                      */
/* .01 Initial Release 18-Jul-2005                      */
/* -------------------------------                      */
/*                                                      */
/********************************************************/

header("Cache-Control: no-store, no-cache");
error_reporting(E_ALL);

/*--------------*/
/* Header       */
/*--------------*/

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 Icecast     */
/*----------------------*/

echo "---------------------------------------------<br>";
$pid = exec("ps -o \"%p\" --noheaders -C icecast");
if ($pid >=1) {
echo "Icecast Running on PID $pid <br>";
echo "Sending SIGINT to Stop Icecast<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 "---Icecast Status---<br>";
echo "--------------------<br>";

$pid2 = exec("ps -o \"%p\" --noheaders -C icecast");
if ($pid >=1 && $pid2 <=1) {
        echo "Icecast2 Stopped<br>";
}
if ($pid2 <=1) {
        echo "Icecast2 Not Running<br>";
}
if ($pid2 >=1 && $pid >=1) {
        echo "Icecast2 Running On PID $pid2<br>";
        echo "Icecast2 Failed To Stop<br>";
        echo "Please Try Again<br>";
}
?>
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber