Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: f6e7410549
Fetching contributors…

Cannot retrieve contributors at this time

46 lines (32 sloc) 0.829 kB
#!/bin/bash
JOB=batarang
BASE=/var/vcap
export PATH=$BASE/packages/ruby/bin:$PATH
export BUNDLE_GEMFILE=$BASE/packages/$JOB/Gemfile
RUN_DIR=$BASE/sys/run/$JOB
LOG_DIR=$BASE/sys/log/$JOB
BIN_DIR=$BASE/packages/$JOB/bin
STORE_DIR=$BASE/store/$JOB
PIDFILE=$RUN_DIR/$JOB.pid
RUNAS=vcap
case $1 in
start)
mkdir -p $RUN_DIR $LOG_DIR $STORE_DIR
chown -R $RUNAS:$RUNAS $RUN_DIR $LOG_DIR $STORE_DIR
echo $$ > $PIDFILE
export NATS_URI='<%= properties.mbus %>'
exec chpst -u $RUNAS:$RUNAS \
bundle exec $BIN_DIR/batarang <%= spec.index %> \
>>$LOG_DIR/$JOB.stdout.log \
2>>$LOG_DIR/$JOB.stderr.log
;;
stop)
PID=$(head -1 $PIDFILE)
kill $PID
while [ -e /proc/$PID ]; do sleep 0.1; done
rm -f $PIDFILE
;;
*)
echo "Usage: $JOB_ctl {start|stop}" ;;
esac
exit 0
Jump to Line
Something went wrong with that request. Please try again.