[icecast] reconnecting liveice

Luis Gallardo gluis at alsuites.com
Wed Apr 17 23:14:07 UTC 2002



I just fix it.  I realized when there is a connection to the Icecast
sever the output of ps ax | grep liveice is :

20566 ?        S      0:05 /home/lgallard/liveice/liveice -@ 2 -F
/home/lgallard
20568 ?        S      0:00 /home/lgallard/liveice/liveice -@ 2 -F
/home/lgallard
20569 ?        S      4:22 notlame -m j -s 44.100000 -b 32 -r -x
.liveice_temp_f
20676 pts/19   S      0:00 grep live

And when there isn't a connection to the server:

20566 ?        S      0:06 /home/lgallard/liveice/liveice -@ 2 -F
/home/lgallard
20569 ?        S      4:41 notlame -m j -s 44.100000 -b 32 -r -x
.liveice_temp_f
20731 pts/19   S      0:00 grep live

So, I did a script that counts the number of lines and reconnects
liveice to Icecast if it is needed.

Here you  the perl script:

###################################

#!/usr/bin/perl

$_= `ps ax | grep live | wc -l  `;

print $_;

if(m/5/){
        print `echo "LiveIce is already running"`;
        `echo "It's up" > radio.status`;
}
else{

        $_= `ps axr`;

        #print $_;

        if(!m/live/){

                print `echo "Starting LiveIce"`;

                `echo "It was NOT running" > radio.status`;
                `/usr/bin/killall liveice`;
                `/home/user/liveice/liveice -@ 2 -F /home/user/liveice/liveice.cfg`;

                print `echo "[OK]\n"`;
        }
} 

# End of the script
####################################

<p>Don't ask me why 5 instead of 4, because I don't know either.

<p>Luis Gallardo wrote:
> 
> Hi everybody.
> 
> Is there a way to set up liveice so it reconnects to Icecast
> automatically when the connection is lost?.
> 
> I tried to automate this process by using a crontab and a perl script,
> but when liveice is run with the -@ 2 option It seams It doesn't realize
> that the connection has been broken and continues "running". If I do ps
> ax, I can see liveice is "running", but I know It's not, because Icecast
> reports that there aren't connected sources.
> 
> I hope you can help me.
> 
> Thanks.
> 


-- 
Luis M. Gallardo D.
Linux User #130502
Caracas - Venezuela

--- >8 ----
List archives:  http://www.xiph.org/archives/
icecast project homepage: http://www.icecast.org/
To unsubscribe from this list, send a message to 'icecast-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Icecast mailing list