#!/bin/sh -e################################################### ## Copyright (c) 2010 Joe Fox, http://jwfoxjr.com ## ## Script to start darkice as a daemon at boot ## eliminating the need to run as sudo or root ## after the system has booted. ## ## All rights reserved. ## ###################################################### BEGIN INIT INFO# Provides: darkice# Required-Start: # Required-Stop: $networking# Default-Start: # Default-Stop: 0 6# Short-Description: Brings up darkice.### END INIT INFOCONFIG_DIR=/etcBIN_DIR=/usr/binPIDFILE=/var/run/darkice.pid#[ -f $CONFIG_DIR/darkice.cfg ] || { echo "ERROR: $CONFIG_DIR/darkice.cfg doesn't exist" ; exit 1; }case "$1" instart) if [ -f $PIDFILE ] then echo "darkice already is already running under PID `cat $PIDFILE`" exit 1 else echo "Starting darkiced." $BIN_DIR/darkice & $BIN_DIR/pgrep darkice > $PIDFILE fi ;;stop) if [ -f $PIDFILE ] then echo "Stopping darkiced." kill -9 `cat $PIDFILE` > /dev/null 2>&1 rm -f $PIDFILE else echo "darkice is currently not running." fi ;;status) if [ -f $PIDFILE ] then echo "darkice is currently running under PID `cat $PIDFILE`" else echo "darkice is currently not running." fi ;;*) echo "Usage: darkiced {start|stop|status}" exit 1 ;;esacexit 0