Skip to content

Instantly share code, notes, and snippets.

@lcx
Created October 24, 2013 16:41
Show Gist options
  • Save lcx/7140624 to your computer and use it in GitHub Desktop.
Save lcx/7140624 to your computer and use it in GitHub Desktop.
Debian bluepill init script
#!/bin/sh
### BEGIN INIT INFO
# Provides: bluepill
# Required-Start: $local_fs $remote_fs $network $syslog $time
# Required-Stop: $local_fs $remote_fs $network $syslog
# 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
NAME=bluepill
DESC=bluepill
set -e
. /lib/lsb/init-functions
CMD="/usr/sbin/bluepill -l /var/log/bluepill.log"
case "$1" in
start)
echo -n "Starting $DESC:"
find /etc/bluepill/*.pill -exec echo "Starting {}" \; -exec $CMD load {} \;
# eval "$CMD load $APP_ROOT/current/config/bluepill.rb'"
;;
stop)
echo "Shutting down monitored processes"
eval "$CMD stop"
echo "Shutting down bluepill daemon"
eval "$CMD quit"
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
;;
status)
eval "$CMD status"
;;
*)
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