Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --file /etc/rc.d/rvm
- #!/bin/bash
- #
- # rc.d init script for rvm environment. It does the following:
- # 1: starts GemDocs for each gemset listed in $GEMSETS
- #
- # Run as user "rvm"
- RUNUSER="rvm"
- [ "$USER" = "root" ] && { su ${RUNUSER} -c "$0 $*"; exit; }
- [ "$USER" = "${RUNUSER}" ] || { echo "$0 must run as ${RUNUSER}"; exit; }
- . /etc/profile # Needed to set up rvm environment
- . /etc/rc.conf
- . /etc/rc.d/functions
- [ -r /etc/conf.d/rvm ] && . /etc/conf.d/rvm
- GEMSETS=${GEMSETS:-system}
- GEMDOCS_PORT=8808
- for GEMSET in ${GEMSETS[@]}
- do
- GEMDOCS_CMD="gem server --daemon --port $GEMDOCS_PORT"
- # Get PID if a process exists with that command line
- PID=$(ps -e -o pid= -o cmd= | grep "$GEMDOCS_CMD" | grep -v grep | awk '{print $1}')
- case "$1" in
- start)
- stat_busy "Starting GemDocs for ${GEMSET}"
- [ -z "$PID" ] && rvm use ${GEMSET} > /dev/null && $GEMDOCS_CMD > /dev/null
- if [ $? = 0 ]; then
- stat_done
- else
- stat_fail
- exit 1
- fi
- ;;
- stop)
- stat_busy "Stopping GemDocs for ${GEMSET}"
- [ -n "$PID" ] && kill $PID &>/dev/null
- if [ $? = 0 ]; then
- stat_done
- else
- stat_fail
- exit 1
- fi
- ;;
- restart)
- $0 stop
- sleep 1
- $0 start
- ;;
- *)
- echo "usage: $0 {start|stop|restart}"
- exit
- esac
- let GEMDOCS_PORT+=1
- done
- --file /etc/conf.d/rvm#
- #
- # Arguments to be passed to the rvm daemons
- # Run GemDocs for these gemsets
- GEMSETS=(system ruby-1.8.6-p420@rails-2.0.2 ruby-1.9.3-p0@rails)
Advertisement
Add Comment
Please, Sign In to add comment