Skip to content

Instantly share code, notes, and snippets.

@baroquebobcat
Forked from cayblood/example_init_d_script.sh
Created January 18, 2010 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baroquebobcat/280453 to your computer and use it in GitHub Desktop.
Save baroquebobcat/280453 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=/usr/bin/bluepill
BLUEPILL_BIN=/usr/local/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