rc: Fix startup scripts when command_interpreter is used
authorMichael Neumann <mneumann@ntecs.de>
Mon, 20 Sep 2010 13:27:03 +0000 (15:27 +0200)
committerMichael Neumann <mneumann@ntecs.de>
Mon, 20 Sep 2010 13:27:03 +0000 (15:27 +0200)
Correct the behaviour when using command_interpreter in
rc.d scripts where the proctitle of ps does not include
the full interpreter path, but for example just "perl: ..."
instead of "/usr/pkg/bin/perl -flags ...".

With this patch, the /etc/rc.d/postgrey stop/status script
of pkgsrc package mail/postgrey works. Other packages seem
to not use command_interpreter at all.

etc/rc.subr

index 7b0e295..616b281 100644 (file)
@@ -359,9 +359,10 @@ _find_processes()
                        warn "\$command_interpreter $_interpreter != $1"
                fi
                _interp="$* $_procname"         # cleanup spaces, add _procname
+               _interpbn="$1"                  # the interpreter binary
                _fp_args='_argv'
                _fp_match='case "$_argv" in
-                   ${_interp}|"${_interp} "*)'
+                   "${_interpbn##*/}: "$_procname*|${_interp}|"${_interp} "*)'
        else                                    # a normal daemon
                _procnamebn=${_procname##*/}
                _fp_args='_arg0 _argv'