[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#316303: apache2-common: apache2ctl -k stop not being used - faulty init.d/apache2 logic



Jason Rhinelander wrote:
>
> if `apache2 -t > /dev/null 2>&1`; then
>
> will always be false, due to being in backticks.

lucifer:~# if `apache2 -t 2>/dev/null`; then echo "YAY, IT WORKS"; else
echo "BROKEN"; fi
YAY, IT WORKS
lucifer:~# echo "RANDOM CRAP" >> /etc/apache2/apache2.conf
lucifer:~# if `apache2 -t 2>/dev/null`; then echo "YAY, IT WORKS"; else
echo "BROKEN"; fi
BROKEN
lucifer:~#

It seems to work fine to me.  Sure, it's weird to have it in backticks,
but it DOES seem to work, as the subshell invoked with the backticks will
exit with the correct error code.

> After fixing this, I also noticed and added a fix for bug 290060, which
> is that `apache2 -k stop' is being called inside this if statement
> instead of `apache2ctl -k stop'.

"apache2ctl stop" just calls "apache2 -k stop" anyway, but I agree that
the init script should be consistent in calling apache2ctl everywhere,
rather than apache2ctl sometimes, and apache2 directly at other times.

... Adam





Reply to: