Skip to content

Instantly share code, notes, and snippets.

@kotashiratsuka
Created December 24, 2013 18:08
Show Gist options
  • Save kotashiratsuka/8116397 to your computer and use it in GitHub Desktop.
Save kotashiratsuka/8116397 to your computer and use it in GitHub Desktop.
RHEL based GitLab initscript.
#!/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