From 5dec13b4d9e1d3600d1b5a09345f0cb0949a34c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Radzis=C5=82aw=20Galler?= Date: Fri, 8 Feb 2013 12:24:03 +0100 Subject: [PATCH] Changed all `sudo` calls to `su --session-command=...` --- init.d/gitlab | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/init.d/gitlab b/init.d/gitlab index d221054..bee44e1 100644 --- a/init.d/gitlab +++ b/init.d/gitlab @@ -45,8 +45,8 @@ start() { exit 1 else if [ `whoami` = root ]; then - sudo -u gitlab -H bash -l -c "nohup bundle exec unicorn_rails $DAEMON_OPTS > /dev/null 2>&1 &" - sudo -u gitlab -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" + su --session-command="nohup bundle exec unicorn_rails $DAEMON_OPTS > /dev/null 2>&1 &" -s /bin/bash gitlab + su --session-command="mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" -s /bin/bash gitlab 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 $UNICORN_PID` - sudo -u gitlab -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" + su --session-command="mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" -s /bin/bash gitlab rm "$UNICORN_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 $UNICORN_PID` - sudo -u gitlab -H bash -l -c "mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" + su --session-command="mkdir -p $PID_PATH && $STOP_SIDEKIQ > /dev/null 2>&1 &" -s /bin/bash gitlab if [ `whoami` = root ]; then - sudo -u gitlab -H bash -l -c "mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" + su --session-command="mkdir -p $PID_PATH && $START_SIDEKIQ > /dev/null 2>&1 &" -s /bin/bash gitlab fi echo "$DESC restarted." else