I've encountered the same problems and have modified my init.d script to
make more useful output and error massages, and also to detect and stop
the Slimserver process more reliably.
Please give any feedback if you have suggestions to further enhance
this script or have other scripts that's working better.
#!/bin/bash
#
# slimserver.init This shell script takes care of starting and
stopping
# the Slim streaming MP3 server.
#
# chkconfig: 345 80 30
# description: Slim streaming MP3 server
# processname: slimserver.pl
# config: /etc/slimserver.conf
# Source function library.
. /etc/rc.d/init.d/functions
# Source networking configuration.
. /etc/sysconfig/network
if [ -f /etc/sysconfig/slimserver ]; then
. /etc/sysconfig/slimserver
fi
# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0
RETVAL=0
prog="SLIMSERVER"
SLIMSERVER_BIN="$SLIMSERVER_HOME/slimserver.pl"
SLIMSERVER_PROC="$SLIMSERVER_HOME/slimserver"
[ -x $SLIMSERVER_BIN -a -f $SLIMSERVER_CFG ] || exit 5
start() {
pidofproc $SLIMSERVER_PROC > /dev/null >2 $1
RETVAL=$?
if [ $RETVAL == 3 ] ; then
echo -n "Starting SlimServer: "
daemon --user $SLIMSERVER_USER $SLIMSERVER_BIN $SLIMSERVER_ARGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/slimserver
return $RETVAL
# echo_success
else
echo -n "Slimserver already running: "
warning
echo
return 3
fi
}
stop() {
pidofproc $SLIMSERVER_PROC > /dev/null >2 $1
RETVAL=$?
if [ $RETVAL == 3 ] ; then
echo -n "Could not find running Slimserver process: "
warning
echo
return 3
else
echo -n "Shutting down SlimServer: "
killproc $SLIMSERVER_PROC
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/slimserver
return $RETVAL
fi
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart|reload)
stop
start
RETVAL=$?
;;
status)
status $SLIMSERVER_PROC
RETVAL=$?
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
esac
exit $RETVAL
--
rogerrb
------------------------------------------------------------------------
rogerrb's Profile: http://forums.slimdevices.com/member.php?userid=2006
View this thread: http://forums.slimdevices.com/showthread.php?t=22846
_______________________________________________
unix mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/unix