]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commitdiff
Merge remote-tracking branch 'ms/initscripts' into next
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 1 Mar 2024 16:13:45 +0000 (16:13 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 1 Mar 2024 16:13:45 +0000 (16:13 +0000)
src/initscripts/system/functions

index 6f53a941badaac4c656e7240f9088023f9a261a9..5a26aef45f843b55b95e628dbc93111a412b425f 100644 (file)
@@ -407,7 +407,7 @@ pidofproc()
 # This will ensure compatibility with previous LFS Bootscripts
 getpids()
 {
-       if [ -z "${PIDFILE}" ]; then
+       if [ -n "${PIDFILE}" ]; then
                pidofproc -s -p "${PIDFILE}" $@
        else
                pidofproc -s $@
@@ -446,6 +446,7 @@ loadproc()
        local pidfile=""
        local forcestart=""
        local nicelevel=""
+       local pid
 
 # This will ensure compatibility with previous LFS Bootscripts
        if [ -n "${PIDFILE}" ]; then
@@ -521,12 +522,19 @@ loadproc()
                (
                        ${cmd} &>/dev/null
                ) &
+               pid="$!"
                evaluate_retval
        else
                ${cmd}
+               pid="$!"
                evaluate_retval # This is "Probably" not LSB compliant, but required to be compatible with older bootscripts
        fi
 
+       # Write the pidfile
+       if [ -n "${pid}" -a -n "${pidfile}" ]; then
+               echo "${pid}" > "${pidfile}"
+       fi
+
        return 0
 }