#!/bin/sh
#
# Startup script for ShoutCast Server
#
# chkconfig: 345 81 81
# description: ShoutCast Server
#
# processname: sc_serv
# pidfile: /var/run/sc_serv.pid
# config: /home/justin/shoutcast/sc_serv.conf
#
## vi shoutcast
# paste this file
# mv shoutcast /etc/init.d/
#
# chkconfig –add shoutcast
#
# /etc/init.d/shoutcast start
#
# /etc/init.d/shoutcast stop
# Source function library.

. /etc/rc.d/init.d/functions

PID_FILE=/var/run/sc_serv.pid
PID=`ps -A | grep sc_serv | awk ‘{print $1;}’`
RETVAL=0

start() {
echo -n $”Starting $DESCR: ”
# daemon java $OPTIONS > /dev/null 2>&1 &

exec sudo -u justin /home/justin/shoutcast/sc_serv /home/justin/shoutcast/sc_serv.conf > /dev/null 2>&1 & RETVAL=$?

[ $RETVAL = 0 ] && touch /var/lock/subsys/sc_serv && echo $!>$PID_FILE && echo_success
echo
return $RETVAL
}
stop() {
echo -n $”Stopping $DESCR: ”
#killproc $PID_FILE
[[ $PID != "" ]] && success && kill $PID || failure
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/sc_serv $PID_FILE
}

# See how we were called.
case “$1″ in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
*)
echo $”Usage: $DESCR {start|stop|restart}”
exit 1
esac
exit $RETVAL

Leave a Reply