Ok, ajd ovako.... nasao sam nesto... kada startujem sve ok startuje server ali kad hocu STOP nece da ga iskljucim ajd pomoc, gde je greska :)
HVALA !!! :D
index.php
Code:
<html>
<head>
<title>ShoutCast Start/Stop Script</title>
</head>
<body>
<br />
<center><b>
ShoutCast Start/Stop Script
</b><br /><br />
<a href="start.php">Server start</a><br />
<a href="stop.php">Server stop</a></center>
</body>
</html>
start.php
Code:
<html>
<head>
<title>ShoutCast: Start</title>
<meta http-equiv="refresh" content="5; URL=start_done.php">
</head>
<body>
<br />
<center><b>Molimo sacekajte...</b></center>
<? exec("./shoutcast_control.sh start") ?>
</body>
</html>
start_done.php
Code:
<html>
<head>
<title>ShoutCast: Start Done</title>
<meta http-equiv="refresh" content="5; URL=index.php">
</head>
<body>
<br />
<br />
<center><b>Server je online...<br />
Nolimo proverite....</b></center>
</body>
</html>
stop.php
Code:
<html>
<head>
<title>ShoutCast: Stop</title>
<meta http-equiv="refresh" content="5; URL=stop_done.php">
</head>
<body>
<br />
<center><b>Molimo sacekajte...</b></center>
<? exec("./shoutcast_control.sh stop") ?>
</body>
</html>
stop_done.php
Code:
<html>
<head>
<title>ShoutCast: Stop Done</title>
<meta http-equiv="refresh" content="5; URL=index.php">
</head>
<body>
<br />
<br />
<center><b>Server je offline...<br />
Molimo proverite....</b></center>
</body>
</html>
shoutcast_control.sh
Code:
#!/bin/bash
# Startup script for the SHOUTcasting Server
#
stop() {
echo "Killing old shoutcast servers."
for oldpid in `ps -A | grep sc_serv | cut -c 0-6`; do
kill -9 $oldpid
done
rm -f /srv/www/vhosts/mojsajt.com/httpdocs/sc/serv/shoutcast.pid
}
start() {
servcount=`expr 0`
for cfile in `ls /srv/www/vhosts/mojsajt.com/httpdocs/sc/serv/`; 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 /srv/www/vhosts/mojsajt.com/httpdocs/sc/serv/sc_serv /srv/www/vhosts/mojsajt.com/httpdocs/sc/serv/$cfile > /dev/null &
/srv/www/vhosts/mojsajt.com/httpdocs/sc/serv/sc_serv /srv/www/vhosts/mojsajt.com/httpdocs/sc/serv/$cfile > /dev/null &
let servcount=servcount+1
done
#Create the pid file...
ps -A | grep sc_serv | cut -c 0-6 > /srv/www/vhosts/mojsajt.com/httpdocs/sc/serv/shoutcast.pid
#Done now!
echo "Started $servcount servers."
}
case "$1" in
start)
if [[ ! -e /srv/www/vhosts/mojsajt.com/httpdocs/sc/serv/shoutcast.pid ]]
then
start $2
if [[ -e /srv/www/vhosts/mojsajt.com/httpdocs/sc/serv/shoutcast.pid ]]
then
echo "Startup [SUCCESS]"
fi
else
echo "Startup [FAILED]"
fi
;;
restart)
stop $2
sleep 4
start $2
if [[ -e /srv/www/vhosts/mojsajt.com/httpdocs/sc/serv/shoutcast.pid ]]
then
echo "Startup [SUCCESS]"
fi
;;
stop)
if [[ -e /srv/www/vhosts/mojsajt.com/httpdocs/sc/serv/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