Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

jwfoxjr
Sunday, September 19th, 2010 at 6:18:34am UTC 

  1. #!/bin/sh -e
  2. ##################################################
  3. #                                           #
  4. # Copyright (c) 2010 Joe Fox, http://jwfoxjr.com #
  5. #                                           #
  6. # Script to start darkice as a daemon at boot    #
  7. # eliminating the need to run as sudo or root    #
  8. # after the system has booted.       #
  9. #                                           #
  10. # All rights reserved.         #
  11. #                                           #
  12. ##################################################
  13. ### BEGIN INIT INFO
  14. # Provides:          darkice
  15. # Required-Start:   
  16. # Required-Stop:     $networking
  17. # Default-Start:     
  18. # Default-Stop:      0 6
  19. # Short-Description: Brings up darkice.
  20. ### END INIT INFO
  21.  
  22. CONFIG_DIR=/etc
  23. BIN_DIR=/usr/bin
  24. PIDFILE=/var/run/darkice.pid
  25.  
  26.  
  27.  
  28. #[ -f $CONFIG_DIR/darkice.cfg ] || { echo "ERROR: $CONFIG_DIR/darkice.cfg doesn't exist" ; exit 1; }
  29.  
  30. case "$1" in
  31. start)
  32.  
  33.   if [ -f $PIDFILE ]
  34.   then
  35.     echo "darkice already is already running under PID `cat $PIDFILE`"
  36.     exit 1
  37.   else
  38.     echo "Starting darkiced."
  39.     $BIN_DIR/darkice &
  40.     $BIN_DIR/pgrep darkice > $PIDFILE
  41.   fi
  42.   ;;
  43.  
  44. stop)
  45.  
  46.   if [ -f $PIDFILE ]
  47.   then
  48.     echo "Stopping darkiced."
  49.     kill -9 `cat $PIDFILE` > /dev/null 2>&1
  50.     rm -f $PIDFILE
  51.   else
  52.     echo "darkice is currently not running."
  53.   fi
  54.   ;;
  55.  
  56. status)
  57.   if [ -f $PIDFILE ]
  58.   then
  59.     echo "darkice is currently running under PID `cat $PIDFILE`"
  60.   else
  61.     echo "darkice is currently not running."
  62.   fi
  63.   ;;
  64.  
  65. *)
  66.   echo "Usage: darkiced {start|stop|status}"
  67.   exit 1
  68.   ;;
  69. esac
  70.  
  71. 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.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



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.

comments powered by Disqus
worth-right
worth-right