Advertising
- jwfoxjr
- Sunday, September 19th, 2010 at 6:18:34am UTC
- #!/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 INFO
- CONFIG_DIR=/etc
- BIN_DIR=/usr/bin
- PIDFILE=/var/run/darkice.pid
- #[ -f $CONFIG_DIR/darkice.cfg ] || { echo "ERROR: $CONFIG_DIR/darkice.cfg doesn't exist" ; exit 1; }
- case "$1" in
- start)
- 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
- ;;
- esac
- exit 0
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.