Author: glen
Date: Wed Nov  5 23:48:21 2008
New Revision: 9970

Modified:
   rc-scripts/trunk/rc.d/init.d/functions
Log:
- add --chdir to daemon()

Modified: rc-scripts/trunk/rc.d/init.d/functions
==============================================================================
--- rc-scripts/trunk/rc.d/init.d/functions      (original)
+++ rc-scripts/trunk/rc.d/init.d/functions      Wed Nov  5 23:48:21 2008
@@ -497,7 +497,7 @@
        typeset errors="" prog="" end="" waitname="" waittime=""
        typeset -i exit_code=0
        local nice=$SERVICE_RUN_NICE_LEVEL
-       local fork user closefds pidfile
+       local fork user closefds pidfile chdir=/
 
        while [ $# -gt 0 ]; do
                case $1 in
@@ -520,6 +520,10 @@
                        prog="/usr/bin/setsid sh -c \""
                        end='&'
                        ;;
+               --chdir)
+                       shift
+                       chdir=$1
+                       ;;
                --closefds)
                        closefds=1
                        ;;
@@ -561,7 +565,7 @@
 
        # And start it up.
        busy
-       cd /
+       cd $chdir
        [ -n "$SERVICE_CPUSET" ] && is_yes "$CPUSETS" && echo $$ > 
"/dev/cpuset/${SERVICE_CPUSET}/tasks"
        if errors=$(
                umask ${SERVICE_UMASK:-$DEFAULT_SERVICE_UMASK};
@@ -595,6 +599,7 @@
                                --nicelevel $nice \
                                ${pidfile:+--pidfile $pidfile} \
                                ${user:+-c $user} \
+                               ${chdir:+--chdir "$chdir"} \
                                ${fork:+-b} \
                                --exec "$prog" \
                                -- ${1:+"$@"}
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to