Skip to content

Commit ed23bbc

Browse files
committed
Merge pull request #34 from dosire/resque_restart
Update restart in gitlab init to shut down and start up resque.
2 parents 5131bd3 + 772c31d commit ed23bbc

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

init.d/gitlab

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,13 @@ restart() {
7070
cd $APP_ROOT
7171
check_pid
7272
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
73-
echo -n "Restarting $DESC: "
73+
echo "Restarting $DESC..."
7474
kill -USR2 `cat $UNICORN_PID`
75-
kill -USR2 `cat $RESQUE_PID`
76-
echo "$NAME."
75+
kill -QUIT `cat $RESQUE_PID`
76+
if [ `whoami` = root ]; then
77+
sudo -u gitlab -H bash -l -c "mkdir -p $PID_PATH && nohup bundle exec rake environment resque:work QUEUE=post_receive,mailer,system_hook RAILS_ENV=production PIDFILE=$RESQUE_PID > /dev/null 2>&1 &"
78+
fi
79+
echo "$DESC restarted."
7780
else
7881
echo "Error, $NAME not running!"
7982
exit 1
@@ -109,15 +112,15 @@ case "$1" in
109112
restart
110113
;;
111114
reload|force-reload)
112-
echo -n "Reloading $DESC configuration: "
115+
echo -n "Reloading $NAME configuration: "
113116
kill -HUP `cat $PID`
114-
echo "$NAME."
117+
echo "done."
115118
;;
116119
status)
117120
status
118121
;;
119122
*)
120-
echo "Usage: $NAME {start|stop|restart|reload}" >&2
123+
echo "Usage: sudo service gitlab {start|stop|restart|reload}" >&2
121124
exit 1
122125
;;
123126
esac

0 commit comments

Comments
 (0)