Using baselayout-1.9.4-r6, running /etc/init.d/<insert service> status will always have a return value of 0. It would be useful, for scripting purposes, to have it return 0 if the service is running, or non-zero if the service is not running. A work around I'm using now: /etc/init.d/<some service> 2>&1 | grep started > /dev/null Fedora seems to do this currently, with its /sbin/service, and some of the redhat config tools use this to check if services are running.
1.11.x has the same behavior, this change is fine for me ...
Created attachment 55803 [details, diff] patch for runscript It seems that the runscript does have the desired effect, to some extent. It will do it when passed RC_QUIET_STDOUT is set to yes. This patch makes it have a return value regardless of RC_QUIET_STDOUT.
committed to cvs, thanks :)
There may be a slight problem. If you applied my patch as is, the per-init.d status() won't be called if RC_QUIET_STDOUT. This probably isn't desired, but I did it at the time because status called might call einfo and eerror. So, either status() should check RC_QUIET_STDOUT, or probably better, einfo and eerror should check RC_QUIET_STDOUT.
no, i did not use your patch as posted
Created attachment 56225 [details, diff] patch for runscript It seems that eerror and einfo already take RC_QUIET_STDOUT, so those variables don't need to be tested here. Also, if the status is detected as running, then the init script's status is checked, and returned.
that is true but the underlying functions treat the variable a bit differently from status() ... status() never outputs anything if quiet is set to yes while ewarn/eerror will still output stuff