summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorThom Wiggers <thom@thomwiggers.nl>2013-07-18 13:58:58 +0200
committerThom Wiggers <thom@thomwiggers.nl>2013-07-19 11:49:11 +0200
commitb43348b4a1cd8458eefe37c80c7974344cb85a1d (patch)
tree0aa1ce02577a2d3a983b5bad663428729ddd5e02 /lib
parent5cbfd405b09eab3fa7e013ec921383bc49c695dc (diff)
downloadgitlab-ci-b43348b4a1cd8458eefe37c80c7974344cb85a1d.tar.gz
Introduced $APP_USER var for running the service
...as that $APP_USER Solution for gitlabhq/gitlab-ci#186
Diffstat (limited to 'lib')
-rw-r--r--lib/support/init.d/gitlab_ci16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/support/init.d/gitlab_ci b/lib/support/init.d/gitlab_ci
index 30c9787..21bc412 100644
--- a/lib/support/init.d/gitlab_ci
+++ b/lib/support/init.d/gitlab_ci
@@ -14,8 +14,8 @@
# Description: GitLab CI
### END INIT INFO
-
-APP_ROOT="/home/gitlab_ci/gitlab-ci"
+APP_USER="gitlab_ci"
+APP_ROOT="/home/$APP_USER/gitlab-ci"
DAEMON_OPTS="-C $APP_ROOT/config/puma.rb -e production"
PID_PATH="$APP_ROOT/tmp/pids"
WEB_SERVER_PID="$PID_PATH/puma.pid"
@@ -45,8 +45,8 @@ start() {
exit 1
else
if [ `whoami` = root ]; then
- sudo -u gitlab_ci -H bash -l -c "RAILS_ENV=production bundle exec puma $DAEMON_OPTS"
- sudo -u gitlab_ci -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
+ sudo -u $APP_USER -H bash -l -c "RAILS_ENV=production bundle exec puma $DAEMON_OPTS"
+ sudo -u $APP_USER -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
echo "$DESC started"
fi
fi
@@ -58,7 +58,7 @@ stop() {
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
## Program is running, stop it.
kill -QUIT `cat $WEB_SERVER_PID`
- sudo -u gitlab_ci -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
+ sudo -u $APP_USER -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
rm "$WEB_SERVER_PID" >> /dev/null
echo "$DESC stopped"
else
@@ -74,9 +74,9 @@ restart() {
if [ "$PID" -ne 0 -a "$STATUS" -ne 0 ]; then
echo "Restarting $DESC..."
kill -USR2 `cat $WEB_SERVER_PID`
- sudo -u gitlab_ci -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
+ sudo -u $APP_USER -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &"
if [ `whoami` = root ]; then
- sudo -u gitlab_ci -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
+ sudo -u $APP_USER -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &"
fi
echo "$DESC restarted."
else
@@ -123,7 +123,7 @@ case "$1" in
status
;;
*)
- echo "Usage: sudo service gitlab {start|stop|restart|reload}" >&2
+ echo "Usage: sudo service gitlab_ci {start|stop|restart|reload}" >&2
exit 1
;;
esac