Created
December 24, 2013 18:08
-
-
Save kotashiratsuka/8116397 to your computer and use it in GitHub Desktop.
RHEL based GitLab initscript.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# GitLab | |
# Author : @kotashiratsuka | |
# App Version : 6.x | |
# chkconfig: 2345 82 55 | |
# processname: sidekiq | |
# description: Runs sidekiq Apache + Passenger integration. | |
# https://gist.github.com/kotashiratsuka/8116397 | |
# Include RedHat function library | |
. /etc/rc.d/init.d/functions | |
# The username and path to the gitlab source | |
USER=git | |
APP_PATH=/home/$USER/gitlab | |
# The PID and LOCK files used by sidekiq | |
PID=$APP_PATH/tmp/pids/sidekiq.pid | |
LOCK=/var/lock/subsys/sidekiq | |
start() { | |
cd $APP_PATH | |
echo -n $"Starting sidekiq: " | |
daemon --pidfile=$PID --user=$USER "RAILS_ENV=production bundle exec script/background_jobs start" | |
RETVAL=$? | |
[ $RETVAL -eq 0 ] && touch $LOCK | |
echo | |
} | |
stop() { | |
cd $APP_PATH | |
echo -n $"Stopping sidekiq: " | |
killproc -p $PID | |
RETVAL=$? | |
echo | |
} | |
case "$1" in | |
start) | |
start | |
;; | |
stop) | |
stop | |
;; | |
restart) | |
stop | |
start | |
;; | |
status) | |
status -p ${PID} | |
;; | |
*) | |
echo "Usage: $0 {start|stop|restart|status}" >&2 | |
RETVAL=1 | |
;; | |
esac | |
exit $RETVAL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment