[email protected] wrote:
> Bruce Dubbs wrote:
>>> BTW: statusproc() defined in /lib/lsb/init-functions has an "exit 1" just
>>> after
>>> it prints its Usage statement; shouldn't this be a "return 1" instead?
>> statusproc is a function to print out a nicely formatted status message
>>from the results of pidofproc. It was designed to be used in an
>> initialization script as in './script status' If you give it the wrong
>> parameters, then that script should start. If you want to use the info
>> and do error handling, use pidofproc instead.
>
> If that's how it's meant to be used (I presume you meant "script should
> stop") then that makes sense.
Yes, I did mean stop.
> It's an oddball function though - the
> only one in /lib/lsb/init-functions that prints a usage statement and
> the only one that exits instead of returning an error code - which led
> to the confusing (to me anyway) situation where using it on the command
> line with incorrect/missing options prints a usage statement followed
> immediately by terminating your login shell.
It's a convenience function for the boot scripts. Always been that way
AFAIK.
>> statusproc just uses what is returned from pidofproc. Since you are
>
> Aha! After the argument processing loop in statusproc(), the logic in the
> test for the pidfile name is backward; the pidfile argument to statusproc
> never gets passed on to pidofproc():
>
> (lfs-bootscripts-20120116/lfs/lib/services/init-functions line 513-517)
>
> if [ -z "${pidfile}" ]; then
> pidlist=`pidofproc -p "${pidfile}" $@`
> else
> pidlist=`pidofproc $@`
> fi
OK, change -z to -n
-- Bruce
--
http://linuxfromscratch.org/mailman/listinfo/lfs-dev
FAQ: http://www.linuxfromscratch.org/faq/
Unsubscribe: See the above information page