Skip to content

Commit 06b29a7

Browse files
committed
use start/stop rake sidekiq
1 parent 245a726 commit 06b29a7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

init.d/gitlab

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ DAEMON_OPTS="-c $APP_ROOT/config/unicorn.rb -E production"
2020
PID_PATH="$APP_ROOT/tmp/pids"
2121
UNICORN_PID="$PID_PATH/unicorn.pid"
2222
RESQUE_PID="$PID_PATH/sidekiq.pid"
23+
STOP_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:stop"
24+
START_SIDEKIQ="RAILS_ENV=production bundle exec rake sidekiq:start"
2325
NAME="unicorn"
2426
DESC="Gitlab service"
2527

@@ -43,7 +45,7 @@ start() {
4345
else
4446
if [ `whoami` = root ]; then
4547
sudo -u gitlab -H bash -l -c "nohup bundle exec unicorn_rails $DAEMON_OPTS > /dev/null 2>&1 &"
46-
sudo -u gitlab -H bash -l -c "mkdir -p $PID_PATH && RAILS_ENV=production bundle exec rake sidekiq:start > /dev/null 2>&1 &"
48+
sudo -u gitlab -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
4749
echo "$DESC started"
4850
fi
4951
fi
@@ -55,7 +57,7 @@ stop() {
5557
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
5658
## Program is running, stop it.
5759
kill -QUIT `cat $UNICORN_PID`
58-
kill -QUIT `cat $RESQUE_PID`
60+
sudo -u gitlab -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
5961
rm "$UNICORN_PID" >> /dev/null
6062
rm "$RESQUE_PID" >> /dev/null
6163
echo "$DESC stopped"
@@ -72,9 +74,9 @@ restart() {
7274
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
7375
echo "Restarting $DESC..."
7476
kill -USR2 `cat $UNICORN_PID`
75-
kill -QUIT `cat $RESQUE_PID`
77+
sudo -u gitlab -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
7678
if [ `whoami` = root ]; then
77-
sudo -u gitlab -H bash -l -c "RAILS_ENV=production bundle exec rake sidekiq:start > /dev/null 2>&1 &"
79+
sudo -u gitlab -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
7880
fi
7981
echo "$DESC restarted."
8082
else

0 commit comments

Comments
 (0)