[Pkg-nagios-changes] [pkg-mod-gearman] 20/48: Only create subsys in worker init when running as root

Stig Sandbeck Mathisen ssm at debian.org
Sun Nov 24 22:38:10 UTC 2013


This is an automated email from the git hooks/post-receive script.

ssm pushed a commit to branch master
in repository pkg-mod-gearman.

commit 45174fb382cb91767e2bfcfa1cb140915d85989d
Author: awiddersheim <awiddersheim at hotmail.com>
Date:   Sat Sep 7 16:26:14 2013 -0400

    Only create subsys in worker init when running as root
---
 worker/initscript.in | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/worker/initscript.in b/worker/initscript.in
index 5e793f4..ff4b2af 100755
--- a/worker/initscript.in
+++ b/worker/initscript.in
@@ -20,8 +20,8 @@ DAEMON=%WORKERBIN%
 NAME=mod_gearman_worker
 CONFIG=%CONFIG_WORKER%
 PIDFILE=%PIDFILE%
-USER=%USER%
 LOCKFILE=/var/lock/subsys/$NAME
+USER=%USER%
 USERID=`id -u`
 
 # load extra environment variables
@@ -45,7 +45,9 @@ case "$1" in
             $CMD
         fi
         if [ $? -eq 0 ]; then
-            touch $LOCKFILE
+            if [ "$USERID" -eq 0 ]; then
+                touch $LOCKFILE
+            fi
             echo "OK"
         else
             echo "failed"
@@ -64,7 +66,9 @@ case "$1" in
             done
             ps -p $pid > /dev/null 2>&1;
             if [ $? -ne 0 ]; then
-                rm -f $LOCKFILE $PIDFILE
+                if [ "$USERID" -eq 0 ]; then
+                    rm -f $LOCKFILE $PIDFILE
+                fi
                 echo "OK"
                 exit 0;
             else

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-nagios/pkg-mod-gearman



More information about the Pkg-nagios-changes mailing list