Reproducer could be something like this (untested) # service luci start # vim /etc/init.d/luci # set LUCI_ZOPE_TIMEOUT=1 # <command to utilize the machine on 100% so luci stop is slow>& Observed: # service luci stop && pgrep -f luci Shutting down luci: [ OK ] 31800 Expected: # service luci stop && pgrep -f luci Shutting down luci: [ FAIL ] 31800 # grep '[lL]uci' /var/log/messages | tail -n1 [...] Luci did not stop after 1 seconds. --- The issue is in bad handling of $? special variable in (1) the "if" inner context and (2) the "while" outer context. Bash man page says... re (1): > The exit status is the exit status of the last command executed, or zero if > no condition tested true. re (2): > The exit status of the while and until commands is the exit status of the > last do list command executed, or zero if none was executed. Under this conditions, following snippet from stop function in luci initscript: > while [ $cur_wait -lt $max_wait ]; do > sleep 1 > cur_wait=`expr $cur_wait + 1` > luci_running > if [ $? -eq 0 ]; then > break > fi > done will always have, immediately after being executed, exit code of zero and it makes no sense to use it in subsequent conditionals. Action items: a. fix stop function so that it works as per "Expected" b. check the correctness of exit code handling in other parts of initscript
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHSA-2014-1194.html