From: Mariusz Mazur Date: Sat, 6 Jan 2007 00:20:55 +0000 (+0000) Subject: - guess what this file does X-Git-Url: http://git.pld-linux.org/?p=packages%2Fdarkice.git;a=commitdiff_plain;h=9c51af3b5137803789842b11855d6fff0913838d - guess what this file does Changed files: darkice.init -> 1.1 --- diff --git a/darkice.init b/darkice.init new file mode 100644 index 0000000..823b055 --- /dev/null +++ b/darkice.init @@ -0,0 +1,65 @@ +#!/bin/sh +# +# darkice This shell script takes care of starting and stopping darkice +# +# chkconfig: 345 97 23 +# description: Darkice is a stream provider for IceCast/ShoutCast servers + +# Source function library +. /etc/rc.d/init.d/functions + +# Get network config +. /etc/sysconfig/network + +# Check that networking is up. +if is_yes "${NETWORKING}"; then + if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then + msg_network_down darkice + exit 1 + fi +else + exit 0 +fi + +RETVAL=0 +# See how we were called. +case "$1" in + start) + # Check if the service is already running? + if [ ! -f /var/lock/subsys/darkice ]; then + msg_starting darkice + busy + daemon /usr/sbin/daemon -u darkice -o /var/log/darkice.log -P /var/run/darkice -n darkice -- /usr/bin/darkice -c /etc/darkice.cfg >/dev/null + RETVAL=$? + [ $RETVAL -eq 0 ] && ok || fail + [ $RETVAL -eq 0 ] && touch /var/lock/subsys/darkice + else + msg_already_running Darkice + fi + ;; + stop) + # Stop daemons. + if [ -f /var/lock/subsys/darkice ]; then + msg_stopping darkice + busy + /usr/sbin/daemon -P /var/run/darkice -n darkice --stop >/dev/null && ok || fail + rm -f /var/lock/subsys/darkice >/dev/null 2>&1 + else + msg_not_running Darkice + fi + ;; + restart) + $0 stop + $0 start + ;; + status) + status darkice + /usr/sbin/daemon -P /var/run/darkice --verbose --running -n darkice + exit $? + ;; + *) + msg_usage "$0 {start|stop|restart|status}" + exit 3 +esac + +exit $RETVAL