Skip to content

Instantly share code, notes, and snippets.

@sletix
Created October 2, 2012 23:15
Show Gist options
  • Select an option

  • Save sletix/3823908 to your computer and use it in GitHub Desktop.

Select an option

Save sletix/3823908 to your computer and use it in GitHub Desktop.
init.d script with mixed pills
#!/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
LANG="en_GB.UTF-8"
export LANG
set -e
. /lib/lsb/init-functions
# using system bluepill gem in /usr/local/bin
PATH="$PATH:/usr/local/bin"
# here comes default config
USER="app"
APP_ROOT="/home/app"
PILLS="$APP_ROOT/current/config/pills"
CONFIG="/tmp/vdr-services.pill"
# join pill
cat $PILLS/staging.pill $PILLS/vdr-services.pill > $CONFIG
case "$1" in
start)
echo -n "Starting bluepill for user $USER"
bluepill load $CONFIG
;;
stop)
echo "Shutting down monitored processes"
bluepill stop
echo "Shutting down bluepill daemon"
bluepill quit
;;
restart)
## Stop the service and regardless of whether it was
## running or not, start it again.
$0 stop
$0 start
;;
status)
bluepill 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