Skip to content

Instantly share code, notes, and snippets.

@afriza
Created April 2, 2014 02:21
Show Gist options
  • Save afriza/9926935 to your computer and use it in GitHub Desktop.
Save afriza/9926935 to your computer and use it in GitHub Desktop.
Shoutcast Scripts to during start up and to keep it running
#!/bin/sh
#!/usr/bin/perl
### Shoutcast (SC_SERV)
# Taken from: http://forums.winamp.com/showthread.php?postid=2487604
## SC_SERV Server 1
if ( ! ps auxwww | grep "/home/user/sc_serv/sc_serv /home/user/sc_serv/sc_serv.conf" | grep -v grep )
then echo "Shoutcast not running..."
/home/user/sc_serv/sc_serv /home/user/sc_serv/sc_serv.conf &
fi
the following will start up services on boot, and will restart if it fails or crashes. ive tested this on freebsd 6 and 7, centos, macosx
a script that checks to see if the sc_serv is running, if it isnt, start it.
Create a file. name it whatever.. i call mine sc_mon.sh
put the following in it:
#!/bin/sh
#!/usr/bin/perl
### Shoutcast (SC_SERV)
# Taken from: http://forums.winamp.com/showthread.php?postid=2487604
## SC_SERV Server 1
if ( ! ps auxwww | grep "/home/user/sc_serv/sc_serv /home/user/sc_serv/sc_serv.conf" | grep -v grep )
then echo "Shoutcast not running..."
/home/user/sc_serv/sc_serv /home/user/sc_serv/sc_serv.conf &
fi
save and close the file
chmod 777 sc_mon.sh
setup a cron job to run this script every 60 secs... mine looks like this:
*/1 * * * * /home/user/sc_serv/sc_mon.sh >> /dev/null 2>&1
this will execute the script every 60 secs to check if shoutcast is running and will start it if its not.
cheers
DopeLabs
#!/bin/sh
#
# Sample init script for SHOUTcast
# by caraoge
# Released at 11/02/2009 on http://forums.winamp.com/showthread.php?postid=2487604
#
# Check for SHOUTcast binary
test -f /caraoge/sc_serv || exit 0
# The init commands
case "$1" in
start)
echo "Starting SHOUTcast server..."
/caraoge/sc_serv /caraoge/sc_serv.conf &
;;
stop)
echo "Stopping SHOUTcast server..."
kill -9 `ps -C sc_serv -o pid --no-headers`
;;
restart)
echo "Stopping SHOUTcast server..."
kill -9 `ps -C sc_serv -o pid --no-headers`
echo "Starting SHOUTcast server..."
/caraoge/sc_serv /caraoge/sc_serv.conf &
;;
*)
echo "usage: /etc/init.d/shoutcast"
echo "$0 {start | stop | restart}"
exit 1
;;
esac
Step 1:
Create a file named "shoutcast" with the following content in "/etc/init.d/" or
download the attached file, rename, modify and copy it to "/etc/init.d/" (Full path "/etc/init.d/shoutcast"):
Note: You have to edit the path to your SHOUTcast binary and your configuration file
Step 2:
Now you have to make the file executable:
code: chmod 755 /etc/init.d/shoutcast
Step 3:
Create the startup scripts with (Debian!):
code: update-rc.d shoutcast defaults
Step 4:
Now your SHOUTcast server starts up everytime your server pass through its startup sequence.
If your server is running, you can use
code: /etc/init.d/shoutcast start
or
code: /etc/init.d/shoutcast stop
or
code: /etc/init.d/shoutcast restart
to control your SHOUTcast server.
Removing the SHOUTcast server from the startup sequence:
Type this on your command line:
code: update-rc.d -f shoutcast remove
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment