| View previous topic :: View next topic |
| Author |
Message |
Anonymous Guest
|
Posted: Wed Apr 19, 2006 8:28 am Post subject: Autostart |
|
|
anybody got a nice / safe /good way of checking if icecast is running, and if not autostart it ??
Seen couple of ways to start it when rebooting, but this is if your server is running and icecast "dies" on you, i would like it to trigger again and autostart
let's say u check every 30sec, or every 1 min if the "service" is running (eighter icecast or icecast.xml) and if not, start it with the right xml file...
And last but not least...
Anybody got a nice php/html or too that can help me infor users about streams are up or down on several server and stream ??
And anybody got a loadbalancing script ?? so like user 1 gets server1, user 2 gets server 2 and if server 3 is down, user 3 gets server 4 and user 4 gets server 1 ... and so on....
If nobody got anything like this, it would be nice with any help / tips and more...
Thnks for any help
And thnks to icecast.org for a brilliant program and the best support ever.. |
|
| Back to top |
|
 |
Aluizio Neto Guest
|
Posted: Wed Apr 19, 2006 2:42 pm Post subject: Same deal |
|
|
| I`ve got the same issue here.... |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed Apr 19, 2006 4:48 pm Post subject: |
|
|
a trivial automatic restart would be
#!/bin/sh
while [ 1 ]; do
icecast -c /.../icecast.xml
date >> /var/log/icecast/servers
sleep 5; # don't restart too quickly, eg xml error
done
this script could then be put into the background. If you want more icecasts then use $1 to represent the xml file for icecast to use.
You could use the authenticator or on-[dis]connect scripts to indicate if you want say email notifications on stream status.
load balancing is a work in progress, you can still use a randomizing playlist of server urls.
karl. |
|
| Back to top |
|
 |
Guest
|
Posted: Wed Apr 19, 2006 5:52 pm Post subject: Re: Autostart |
|
|
| MrOnline wrote: |
And last but not least...
Anybody got a nice php/html or too that can help me infor users about streams are up or down on several server and stream ??
|
I'm new to PHP, so I post this only as a starting point:
| Code: |
<?php
$server_ip = "servername.com";
$stream_mount = "/mountpoint_name";
$server_port = 8000;
$timeout = 5;
$fp = @fsockopen($server_ip, $server_port, $errno, $errstr, $timeout);
if (!$fp) {
echo "Server is down, stream is unavailable.";
} else {
echo "Server is up";
$request = "GET ".$stream_mount." HTTP/1.0\r\n";
$request .= "User-Agent: php_status_script \r\n\r\n";
fwrite($fp, $request);
$response = fgets($fp, 13);
if ($response == "HTTP/1.0 200") {
echo " and stream is available.";
} else {
echo ", but stream is unavailable.";
}
fclose($fp);
}
?>
|
Leo[/code] |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Wed Apr 19, 2006 5:54 pm Post subject: |
|
|
woops, should have signed in...
Also should have said that that works on one webserver I tried, but on another it fails unless Icecast is running on port 80.
Leo |
|
| Back to top |
|
 |
Aluizio Neto Guest
|
Posted: Wed Apr 19, 2006 8:16 pm Post subject: Date?? |
|
|
| The line about saving the date in the server file is just a log system? It aint necessary, right??? |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed Apr 19, 2006 9:42 pm Post subject: |
|
|
it's not neccessary, it's just a simple way of noting when the server stopped for whatever reason. you could use email or some other notification mechanism. The loop is the key part.
karl. |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Thu Apr 20, 2006 3:30 pm Post subject: php script |
|
|
| wouldnt that script need a "userauth" when i use <hidden>1</hidden> and you have to enter username/password to get info ?? |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Thu Apr 20, 2006 3:47 pm Post subject: |
|
|
If you are you want to trigger a url on stream start/stop thenm you would use the "mount_add" and "mount_remove" options. <hidden> is unrelated to any of these, that is just for hising the mount point from the webroot pages and YP listing. None of the auth url triggers require a username password.
karl. |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Thu Apr 20, 2006 4:09 pm Post subject: ahaaa |
|
|
so thats what the mount_add and mount_remove are for...
so when a "stream" is relay'd and mounted it will trigger the "url" in it...
Nice... |
|
| Back to top |
|
 |
Anonymous Guest
|
Posted: Mon Apr 24, 2006 7:04 pm Post subject: might jsut be me but... |
|
|
| Code: |
#!/bin/sh
while [ 1 ]; do
icecast -c /.../icecast.xml
date >> /var/log/icecast/servers
sleep 5; # don't restart too quickly, eg xml error
done |
Didnt work for me, probably me doing something wrong but..
when i do icecast -b -c icecast.xml all is ok...
then i made a file called startup.sh added the text to it, did chmod +x startup.sh
and when i then su icecast and type ./startup.sh it comes with an error saying it can connect to port 8000 ...
What did i do wrong ?? |
|
| Back to top |
|
 |
Aluizio Neto Guest
|
Posted: Wed Apr 26, 2006 12:39 pm Post subject: Same issue |
|
|
| Im having the exactly same problem here. The program works fine if manualy openned but with the script it cant connect to port 8000 |
|
| Back to top |
|
 |
Aluizio Neto Guest
|
Posted: Wed Apr 26, 2006 2:01 pm Post subject: Stupid me |
|
|
Sorry guys, I was just been stupid.
Actualy the server is running and when it tries to run again (5s later) it gives the error cause the 8000 port is been used by the first running Icecast.
Thanks a lot. |
|
| Back to top |
|
 |
karlH Code Warrior

Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed Apr 26, 2006 3:22 pm Post subject: |
|
|
the previous problem was resolved, you'll have to ask MrOnline about the fix.
karl. |
|
| Back to top |
|
 |
Aluizio Neto Guest
|
Posted: Fri Apr 28, 2006 7:10 pm Post subject: Didn`t get it |
|
|
| Fix what? Everything is working fine now. I just sad that Mr Online and I were wrong. The server was actually running. The message wasn`t about some problem. |
|
| Back to top |
|
 |
|