Skip to content

Commit 740b5f2

Browse files
committed
Fix init.d script for gitlab-ci
1 parent f2fe5a9 commit 740b5f2

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

gitlab-ci/init.d/gitlab_ci

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ DAEMON_OPTS="-p 3000 -d -e production"
2020
PID_PATH="$APP_ROOT/tmp/pids"
2121
THIN_PID="$PID_PATH/thin.pid"
2222
RESQUE_PID="$PID_PATH/resque_worker.pid"
23+
RESQUE_2_PID="$PID_PATH/resque_schedule.pid"
2324
NAME="thin"
2425
DESC="Gitlab CI service"
2526

@@ -42,8 +43,9 @@ start() {
4243
exit 1
4344
else
4445
if [ `whoami` = root ]; then
45-
sudo -u $USER -H sh -l -c "nohup bundle exec thin start $DAEMON_OPTS > /dev/null 2>&1 &"
46-
sudo -u $USER -H sh -l -c "mkdir -p $PID_PATH && nohup bundle exec rake environment resque:work QUEUE=runner RAILS_ENV=production PIDFILE=$RESQUE_PID > /dev/null 2>&1 &"
46+
sudo -u $USER -H bash -l -c "bundle exec thin start $DAEMON_OPTS"
47+
sudo -u $USER -H bash -l -c "nohup bundle exec rake environment resque:work QUEUE=runner,scheduler_task RAILS_ENV=production PIDFILE=tmp/pids/resque_worker.pid > ./log/resque.log &"
48+
sudo -u $USER -H bash -l -c "nohup bundle exec rake environment resque:scheduler RAILS_ENV=production PIDFILE=tmp/pids/resque_schedule.pid > ./log/schedule.log &"
4749
echo "$DESC started"
4850
fi
4951
fi
@@ -56,6 +58,7 @@ stop() {
5658
## Program is running, stop it.
5759
kill -QUIT `cat $THIN_PID`
5860
kill -QUIT `cat $RESQUE_PID`
61+
kill -QUIT `cat $RESQUE_2_PID`
5962
rm "$THIN_PID" >> /dev/null
6063
rm "$RESQUE_PID" >> /dev/null
6164
echo "$DESC stopped"
@@ -72,7 +75,8 @@ restart() {
7275
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
7376
echo -n "Restarting $DESC: "
7477
kill -USR2 `cat $THIN_PID`
75-
kill -USR2 `cat $RESQUE_PID`
78+
kill -QUIT `cat $RESQUE_PID`
79+
kill -QUIT `cat $RESQUE_2_PID`
7680
echo "$NAME."
7781
else
7882
echo "Error, $NAME not running!"

0 commit comments

Comments
 (0)