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 

Autostart
Goto page 1, 2  Next
 
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: Wed Apr 19, 2006 8:28 am    Post subject: Autostart Reply with quote

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 Smile
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





PostPosted: Wed Apr 19, 2006 2:42 pm    Post subject: Same deal Reply with quote

I`ve got the same issue here....
Back to top
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Wed Apr 19, 2006 4:48 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Guest






PostPosted: Wed Apr 19, 2006 5:52 pm    Post subject: Re: Autostart Reply with quote

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





PostPosted: Wed Apr 19, 2006 5:54 pm    Post subject: Reply with quote

woops, should have signed in... Embarassed

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





PostPosted: Wed Apr 19, 2006 8:16 pm    Post subject: Date?? Reply with quote

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
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Wed Apr 19, 2006 9:42 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Anonymous
Guest





PostPosted: Thu Apr 20, 2006 3:30 pm    Post subject: php script Reply with quote

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
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Thu Apr 20, 2006 3:47 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Anonymous
Guest





PostPosted: Thu Apr 20, 2006 4:09 pm    Post subject: ahaaa Reply with quote

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





PostPosted: Mon Apr 24, 2006 7:04 pm    Post subject: might jsut be me but... Reply with quote

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 ... Sad

What did i do wrong ??
Back to top
Aluizio Neto
Guest





PostPosted: Wed Apr 26, 2006 12:39 pm    Post subject: Same issue Reply with quote

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





PostPosted: Wed Apr 26, 2006 2:01 pm    Post subject: Stupid me Reply with quote

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
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Wed Apr 26, 2006 3:22 pm    Post subject: Reply with quote

the previous problem was resolved, you'll have to ask MrOnline about the fix.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Aluizio Neto
Guest





PostPosted: Fri Apr 28, 2006 7:10 pm    Post subject: Didn`t get it Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
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