Skip to content

Instantly share code, notes, and snippets.

@naokij
Created February 20, 2012 04:15
Show Gist options
  • Save naokij/1867812 to your computer and use it in GitHub Desktop.
Save naokij/1867812 to your computer and use it in GitHub Desktop.
/etc/init.d/graylog2-web-interface
#!/bin/bash
#
# graylog2-web-interface: graylog2 web interface
#
# chkconfig: - 98 02
# description: Starts graylog2-web-interface using passenger-standalone. \
# Uses RVM to use switch to a specific ruby version.
#
# config
USER=graylog
APP_DIR=/opt/graylog2-web-interface
RVM_RUBY=1.9.2
ADDR=127.0.0.1
PORT=3000
ENVIRONMENT=production
LOG_FILE=/var/log/graylog2-web-interface.log
# --
CMD_START="cd $APP_DIR; rvm use $RVM_RUBY; passenger start -d \
-a $ADDR \
-p $PORT \
-e $ENVIRONMENT \
--user $USER"
CMD_STOP="cd $APP_DIR; rvm use $RVM_RUBY; passenger stop -p $PORT"
CMD_STATUS="cd $APP_DIR; rvm use $RVM_RUBY; passenger status -p $PORT"
. /lib/lsb/init-functions
case "$1" in
start)
echo "Starting graylog2-web-interface"
su - $USER -c "$CMD_START"
;;
stop)
echo "Stopping graylog2-web-interface"
su - $USER -c "$CMD_STOP"
;;
status)
su - $USER -c "$CMD_STATUS"
;;
*)
echo "Usage: $0 start|stop|status" >&2
exit 3
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment