SOURCES: apache.init - use $RETVAL, as echo does not propagete err...

Andrzej Krzysztofowicz ankry at green.mif.pg.gda.pl
Wed May 18 16:32:55 CEST 2005


glen wrote:
> 
> Author: glen                         Date: Wed May 18 14:19:49 2005 GMT
> Module: SOURCES                       Tag: HEAD
> ---- Log message:
> - use $RETVAL, as echo does not propagete error code

At least partially to be reverted.
RETVAL is returned by script.
LSB says "stop" must always return 0. As it must not fail.

> ================================================================
> Index: SOURCES/apache.init
> diff -u SOURCES/apache.init:1.37 SOURCES/apache.init:1.38
> --- SOURCES/apache.init:1.37	Thu Apr 28 16:28:23 2005
> +++ SOURCES/apache.init	Wed May 18 16:19:44 2005
> @@ -61,9 +61,9 @@
>  	if [ -f /var/lock/subsys/httpd ]; then
>  		msg_stopping httpd.${HTTPD_MPM}
>  		daemon --waitforname httpd.${HTTPD_MPM} --waitfortime 60 httpd.${HTTPD_MPM} $CFG -k stop
> -		RET=$?
> +		RETVAL=$?
>  		# Delete pidfile only when apache was called successfully
> -		if [ $RET -eq 0 ]; then
> +		if [ $RETVAL -eq 0 ]; then
>  			rm -f /var/lock/subsys/httpd /var/run/httpd.pid /var/run/httpd.loc* >/dev/null 2>&1
>  		fi
>  	else
> @@ -83,13 +83,13 @@
>  	if [ -f /var/lock/subsys/httpd ]; then
>  		msg_reloading httpd.${HTTPD_MPM}
>  		httpd.${HTTPD_MPM} $CFG -t > /dev/null 2>&1
> -		if [ $? -eq 0 ]; then
> +		RETVAL=$?
> +		if [ $RETVAL -eq 0 ]; then
>  		    daemon httpd.${HTTPD_MPM} $CFG -k graceful

daemon is assumed never to fail ?
Even in future ?

>  		else
>  		    fail
>  		    echo "Configuration file syntax test failed."
>  		fi
> -		RETVAL=$?
>  	else
>  		msg_not_running httpd.${HTTPD_MPM} >&2
>  		RETVAL=7

-- 
=======================================================================
  Andrzej M. Krzysztofowicz               ankry at mif.pg.gda.pl
  phone (48)(58) 347 14 61
Faculty of Applied Phys. & Math.,   Gdansk University of Technology



More information about the pld-devel-en mailing list