Skip to content

Instantly share code, notes, and snippets.

@cayblood
Created January 8, 2010 15:58
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save cayblood/272125 to your computer and use it in GitHub Desktop.
Save cayblood/272125 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Author: Carl Youngblood, 2010
# Based on http://www.novell.com/coolsolutions/feature/15380.html
### BEGIN INIT INFO
# Provides: bluepill
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: bluepill daemon, providing process monitoring
# Description: bluepill is a monitoring tool. More info at http://github.com/arya/bluepill.
### END INIT INFO
# Check for missing binaries
BLUEPILL_BIN=/var/lib/gems/1.8/bin/bluepill
test -x $BLUEPILL_BIN || { echo "$BLUEPILL_BIN not installed";
if [ "$1" = "stop" ]; then exit 0;
else exit 5; fi; }
# Check for existence of needed config file and read it
BLUEPILL_CONFIG=/etc/bluepill.conf
test -r $BLUEPILL_CONFIG || { echo "$BLUEPILL_CONFIG not existing";
if [ "$1" = "stop" ]; then exit 0;
else exit 6; fi; }
case "$1" in
start)
echo -n "Starting bluepill "
$BLUEPILL_BIN load $BLUEPILL_CONFIG
;;
stop)
echo -n "Shutting down bluepill "
$BLUEPILL_BIN quit
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
*)
## If no parameters are given, print which are avaiable.
echo "Usage: $0 {start|stop|restart}"
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment