sc_trans startup script
01月 18th, 2008
#!/bin/sh
#
# Startup script for ShoutCast sc_trans Server
#
# chkconfig: 345 81 81
# description: ShoutCast sc_trans Server
#
# processname: sc_trans
# pidfile: /var/run/sc_trans.pid
# config: /home/justin/shoutcast/sc_trans.conf
#
# 1. vi sc_trans
# 2. paste this file
# 3. edit line 35
# 4. mv sc_trans /etc/init.d/
# 5. chkconfig -add sc_trans
#
# Start
# /etc/init.d/sc_trans start
#
# Stop
# /etc/init.d/sc_trans stop
#
# Source function library.
. /etc/rc.d/init.d/functions
PID_FILE=/var/run/sc_trans.pid
PID=`ps -A | grep sc_trans | awk ‘{print $1;}’`
RETVAL=0
start() {
echo -n $”Starting $DESCR: ”
exec sudo -u justin /home/justin/shoutcast/sc_trans_linux /home/justin/shoutcast/sc_trans.conf > /dev/null 2>&1 & RETVAL=$?
[ $RETVAL = 0 ] && touch /var/lock/subsys/sc_trans && 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_trans $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