Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add a note to the readme about RVM integration with init scripts #77

Open
jondkinney opened this Issue · 1 comment

2 participants

@jondkinney

If you follow this: http://rvm.beginrescueend.com/integration/god/ and create a wrapper script for bluepill then you can reference that wrapper script "bootup_bluepill" in an init.d script and it will load up the RVM environment properly and "just work".

/etc/init.d/bluepill init script

#!/bin/sh

# Author: Jon Kinney
# Based on the opensuse skeleton /etc/init.d/skeleton init script

### 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

# bootup_bluepill is a wrapper script created based on this info http://rvm.beginrescueend.com/integration/god/

export PATH="/home/ubuntu/.rvm/gems/ree-1.8.7-2010.02@phatool/bin:/home/ubuntu/.rvm/gems/ree-1.8.7-2010.02@global/bin:/home/ubuntu/.rvm/rubies/ree-1.8.7-2010.02/bin:/home/ubuntu/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"

# Check for missing binaries
BLUEPILL_BIN=/home/ubuntu/.rvm/gems/ree-1.8.7-2010.02@phatool/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=/srv/www/thedacare/shared/config/delayed_job.pill
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 "
        bootup_bluepill load $BLUEPILL_CONFIG
        ;;
    stop)
        echo -n "Shutting down bluepill "
        bootup_bluepill quit
        # I would have liked to do this ---- kill `cat /srv/www/thedacare/shared/pids/delayed_job.pid`
        rm /srv/www/thedacare/shared/pids/delayed_job.pid
        ;;
    restart)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        $0 start
        ;;
    *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac
@QaDeS

Just generating the wrapper should be enough. Bluepill already understands start, stop, restart and status commands, so it's prepared for directly running as a service. Only thing is the INIT INFO section, which should probably go into the wrapper and the bluepill executable to ease the (de-)activation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.