rc-scripts/trunk/rc.d/init.d/functions

Elan Ruusamäe glen at delfi.ee
Wed Sep 7 00:12:15 CEST 2005


On Monday 05 September 2005 20:12, arekm wrote:
> Author: arekm
> Date: Mon Sep  5 19:12:09 2005
> New Revision: 6352
>
> Modified:
>    rc-scripts/trunk/rc.d/init.d/functions
> Log:
> Add support for whole path in pidfile.
>
> Modified: rc-scripts/trunk/rc.d/init.d/functions
> ===========================================================================
>=== --- rc-scripts/trunk/rc.d/init.d/functions	(original)
> +++ rc-scripts/trunk/rc.d/init.d/functions	Mon Sep  5 19:12:09 2005
> @@ -656,10 +656,15 @@
>  	fi
>
>  	# First try pidfile or "/var/run/*.pid"
> -	if [ -f /var/run/${pidfile} ] ; then
> +	if (echo "${pidfile}" | grep -Eq "^/"); then
> +		pidfile="${pidfile}"
> +	else
> +		pidfile="/var/run/${pidfile}";
> +	fi

what about using [[ syntax? (ksh supports it)

if [[ "${pidfile}"  == "/*" ]]; then

> +	if [ -f "${pidfile}" ] ; then
>  		typeset line p pid
>  		pid=
> -		read line < /var/run/${pidfile}
> +		read line < "${pidfile}"
>  		for p in $line; do
>  			[ -z "$(echo "$p" | awk '{gsub(/[0-9]/,"");print;}')" ] && pid="$pid
> $p" done
> _______________________________________________
> pld-cvs-commit mailing list
> pld-cvs-commit at lists.pld-linux.org
> http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

-- 
Elan Ruusamäe
http://www.DELFI.ee/
Rävala pst 6, 10143, Tallinn, Eesti
tel (secretary): +372 650 4922
tel: +372 650 1278
fax: +372 681 4719
mailto:glen at delfi.ee



More information about the pld-devel-en mailing list