Autostart your Shoutcast Server

April 6, 2006

I have not been using shoutcast for long. But here is the unix shell script to autostart your shoutcast server or any other services once it is down. First create a blank file on your shell command like this

touch autostart-shoutcast

Then use your favorite text editor program such as nano, pico or vi and insert the following unix shell script:

#!/usr/bin/perl

@a=qx{ps x | grep -i shoutcast-radio};
$b=1;

foreach (@a) {
  if ($_ =~ /grep/) {
  $_ =~ s/.*/blah/g;
  }
  if ($_ =~ /shoutcast-radio/) {$b=0;}
}

if ($b == 1) {
  print “Starting up\n”;
  qx{cd ~/shoutcast/ ; ./shoutcast-radio &> /dev/null &};
}

Make sure it is executable, using the chmod command like below:

chmod 755 autostart-shoutcast

Finally setup your crontab like below:

0,10,20,30,40,50 * * * * /home/shoutcast/autostart-shoutcast &> /dev/null

Filed under: Unix / Linux

Leave a Comment

(required)

(required), (Hidden)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

TrackBack URL  |  RSS feed for comments on this post.


 

April 2006
M T W T F S S
« Nov   May »
 12
3456789
10111213141516
17181920212223
24252627282930

Pages

Blogroll

Categories