Hi, I'm new to this but am getting there slowly but surely. Sorry if this is long winded.
I just have a slight problem an thought someone might be able to help me.
Basically, I have mpg123 tuned in to a Shoutcast stream and it is relayed to another server (at lower bitrate) using a perl script (a very slightly modified version of this www .netwise.it/xml/perlmonks/?node_id=66521) - I have 2 streams running, 48k and 24k.
The only trouble is that it is quite unstable and sometimes stops, so I have knocked together a script that checks that the streams are still running (10 seconds between each), here it is:
while [ 1 ]
if [ ! "$(ps ax | grep script1.pl | grep -v grep)" ]
if [ ! "$(ps ax | grep script2.pl | grep -v grep)" ]
The only problem is that sometimes the stream seems to freeze and the pl script doesnt actually die.
I have found that when it all works well, and I run ps ax | grep script1.pl | grep -v grep
I get this as the output
9582 ? S 0:00 /usr/bin/perl /path/to/script1.pl
but when it has frozen, I get this (as an example)
9582 ? R 1.24 /usr/bin/perl /path/to/script1.pl
I'll be honest - I'm not entirely sure what the 'S' and 'R' above mean, but it seems that if the script is running well it displays 'S' and if not it displays 'R' form what I've seen. Is there a way to use the grep command to only display 'R' or 'S'? If so it will be easy becase I can just write the script to stop and restart the streams if the output is 'R'. Or is there an alternative that I could use.
Maybe I've got it scompletely twisted and theres just a much better way.
You'll have to excuse my complete lack of understanding with this and I have probably explained it badly lol, like I say I've only just started learning.
Thanks for your help