Aileen Kutschik
Grünschnabel
Hallo Liebe Community, ich habe folgendes problem.
ich muss einen shoutcastserver per php starten und stoppen können.
mein phpscript lautet wie folgt:
das ist vorerst nur das stoppen, bis ich rausgefunden habe wie es richtig geht ^^
der inhalt der "script" datei:
soweit so gut.
wenn ich mein phpscript aufrufe sagt es mir zwar Shoutcast stopping [SUCCESS], tut es aber nicht.
kann mir hier jemand unter die arme greifen? bin langsam am verzweifeln ._.
ich muss einen shoutcastserver per php starten und stoppen können.
mein phpscript lautet wie folgt:
PHP:
<?
$out = array();
exec('/shoutcast/8015/script stop', $out);
print_r($out);
?>
das ist vorerst nur das stoppen, bis ich rausgefunden habe wie es richtig geht ^^
der inhalt der "script" datei:
Code:
#!/bin/bash
# Startup script for the SHOUTcasting Server
#
# chkconfig: - 85 15
# Source networking configuration.
#. /etc/sysconfig/network
# Check that networking is up. This line may cause an error on incompatible
# distributions. Remove it if necessary. Also remove if the startup always
# fails for no apparent reason.
[[ ${NETWORKING} = "no" ]] && exit 0
stop() {
echo "Killing old shoutcast servers."
codpid=$(ps ax | grep sc_serv8015 | awk '{print $1}')
#for oldpid in `ps -A | grep sc_serv8015 | cut -c 0-6`; do
kill -9 $codpid
#done
rm -f /shoutcast/8015/shoutcast.pid
}
start() {
servcount=`expr 0`
for cfile in `ls /shoutcast/8015/`; do
echo -n $cfile
echo -n " -> "
grep ^RelayServer /etc/shoutcast/$cfile
# This is the line where we actually run the shoutcast program!
#sudo -u nobody /shoutcast/8015/sc_serv8015 > /dev/null &
/shoutcast/8015/sc_serv8015 > /dev/null &
let servcount=servcount+1
done
#Create the pid file...
ps -A | grep sc_serv8015 | cut -c 0-6 > /shoutcast/8015/shoutcast.pid
#Done now!
echo "Started $servcount servers."
}
case "$1" in
start)
if [[ ! -e /shoutcast/8015/shoutcast.pid ]]
then
start $2
if [[ -e /shoutcast/8015/shoutcast.pid ]]
then
echo "Startup [SUCCESS]"
fi
else
echo "Startup [FAILED]"
fi
;;
restart)
stop $2
sleep 4
start $2
if [[ -e /shoutcast/8015/shoutcast.pid ]]
then
echo "Startup [SUCCESS]"
fi
;;
stop)
if [[ -e /shoutcast/8015/shoutcast.pid ]]
then
stop $2
echo "Shoutcast shutdown [SUCCESS]"
else
echo "There are no registered shoutcast servers running right now. Attempting to kill anyways."
stop $2
fi
;;
*)
echo "Usage: shoutcast (start|stop|restart)"
;;
esac
soweit so gut.
wenn ich mein phpscript aufrufe sagt es mir zwar Shoutcast stopping [SUCCESS], tut es aber nicht.
kann mir hier jemand unter die arme greifen? bin langsam am verzweifeln ._.