SHOUTcast Daemon in Linux
Saturday, June 11, 2011 8:35:45 AM
I wish SHOUTcast came with a daemon so you didn’t have to start it by hand on every boot. So I found a daemon and modified it a little bit to remove user interaction with the service.
#!/bin/sh
# full path to sc_serv
DAEMON="/home/shoutcast/sc_serv"
# full path to sc_serv.conf (or whatever you call it)
CONFIG="/home/shoutcast/sc_serv.conf"
# Check for SHOUTcast binary
test -f $DAEMON || exit 0
# The init commands
case "$1" in
start)
echo "Starting SHOUTcast server..."
$DAEMON $CONFIG > /dev/null 2>&1 &
;;
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..."
$DAEMON $CONFIG > /dev/null 2>&1 &
;;
*)
echo "usage: /etc/rc.d/sc_serv"
echo "$0 {start | stop | restart}"
exit 1
;;
esac
