From 5c4c29b0952ae0a6094469d8182ec58cde619109 Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Mon, 2 Dec 2013 13:36:59 +0100 Subject: [PATCH 1/2] Adding the init.d script without unicorn or puma, just sidekiq --- init/sysvinit/centos/gitlab-only-sidekiq | 105 +++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100755 init/sysvinit/centos/gitlab-only-sidekiq diff --git a/init/sysvinit/centos/gitlab-only-sidekiq b/init/sysvinit/centos/gitlab-only-sidekiq new file mode 100755 index 0000000..43f03dd --- /dev/null +++ b/init/sysvinit/centos/gitlab-only-sidekiq @@ -0,0 +1,105 @@ +#!/bin/bash +# +# GitLab +# Contributors : @elvanja, @troyanov, @eiyaya, @foyo23, @nielsbasjes, @relip, @JasonMing, @andronat, @axilleas +# App Version : 6.x + +# chkconfig: 2345 82 55 +# processname: sidekiq +# description: Runs unicorn and sidekiq for nginx integration. + +# Related (kudos @4sak3n0ne): +# https://github.com/gitlabhq/gitlabhq/issues/1049#issuecomment-8386882 +# https://gist.github.com/3062860 + +# Include RedHat function library +. /etc/rc.d/init.d/functions + +# The name of the service +NAME=${0##*/} + +### Environment variables +RAILS_ENV="production" + +# The username and path to the gitlab source +USER=git +APP_PATH=/home/git/gitlab + +# The PID and LOCK files used by unicorn and sidekiq +SPID=$APP_PATH/tmp/pids/sidekiq.pid +SLOCK=/var/lock/subsys/sidekiq + +# Evaluate the real path for the user (should already have RVM) +PATH_PATCH="PATH=$(su $USER -l -c "echo \"\$PATH\"") && export PATH && " + +start() { + cd $APP_PATH + + # Start sidekiq + echo -n $"Starting sidekiq: " + daemon --pidfile=$SPID --user=$USER "$PATH_PATCH RAILS_ENV=$RAILS_ENV script/background_jobs start" + sidekiq=$? + [ $sidekiq -eq 0 ] && touch $SLOCK + echo + + retval=$sidekiq + return $retval +} + +stop() { + cd $APP_PATH + + # Stop sidekiq + echo -n $"Stopping sidekiq: " + killproc -p $SPID + sidekiq=$? + [ $sidekiq -eq 0 ] && rm -f $SLOCK + echo + + retval=$sidekiq + return $retval +} + +restart() { + stop + start +} + +get_status() { + status -p $SPID sidekiq + sidekiq=$? + + retval=$sidekiq + return $retval +} + +query_status() { + get_status >/dev/null 2>&1 + return $? +} + +case "$1" in + start) + query_status && exit 0 + start + ;; + stop) + query_status || exit 0 + stop + ;; + restart) + restart + ;; + status) + get_status + exit $? + ;; + *) + N=/etc/init.d/$NAME + echo "Usage: $N {start|stop|restart|status}" >&2 + exit 1 + ;; +esac + +exit 0 + From ba0ab28824de3349e7084f23cb28ed39ae74bf2d Mon Sep 17 00:00:00 2001 From: Tomas Fernandez Date: Mon, 2 Dec 2013 13:40:17 +0100 Subject: [PATCH 2/2] Editing gitlab-only-sidekiq script description --- init/sysvinit/centos/gitlab-only-sidekiq | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/sysvinit/centos/gitlab-only-sidekiq b/init/sysvinit/centos/gitlab-only-sidekiq index 43f03dd..d5df2c9 100755 --- a/init/sysvinit/centos/gitlab-only-sidekiq +++ b/init/sysvinit/centos/gitlab-only-sidekiq @@ -6,7 +6,7 @@ # chkconfig: 2345 82 55 # processname: sidekiq -# description: Runs unicorn and sidekiq for nginx integration. +# description: Runs sidekiq for nginx integration. # Related (kudos @4sak3n0ne): # https://github.com/gitlabhq/gitlabhq/issues/1049#issuecomment-8386882