svn commit: r424939 - in head/sysutils/cbsd: . files

Mathieu Arnold mat at FreeBSD.org
Sun Oct 30 09:39:53 UTC 2016


Le 30/10/2016 à 10:22, Jason E. Hale a écrit :
>  
>  cbsdd_stop()
>  {
> -	[ -f "${pidfile}" ] && kill -9 $( /bin/cat ${pidfile} )
> +	if [ -f "${pidfile}" ]; then
> +		kill -9 $( /bin/cat ${pidfile} )

This should be pkill -9 -f ${pidfile}

> +		/bin/rm -f ${pidfile}
> +	fi
>  }
>  
>  cbsdd_reload()
>  {
> -	[ -f "${pidfile}" ] && kill -9 $( /bin/cat ${pidfile} ) > /dev/null 2>&1
> +	if [ -f "${pidfile}" ]; then
> +		kill -9 $( /bin/cat ${pidfile} ) > /dev/null 2>&1
> +		/bin/rm -f ${pidfile}
> +	fi
>  	run_rc_command "start"

I think this should simply be run_rc_command "restart" but then, it is
semantically wrong, reload means tell the process "hey, reload your
config" or something, not stop/start, that is restart :-)

>  	exit 0
>  }
>  
> +cbsdd_status()
> +{
> +	if [ -f "${pidfile}" ]; then
> +		pids=$( /bin/cat ${pidfile} )
> +		echo "${name} is running as pid ${pids}."
> +	else
> +		echo "${name} is not running."
> +		return 1
> +	fi
> +}

This is somewhat wrong, it checks that the pid file exists, but this
file existing does not mean the process is there, it should at least be
something like:

if [ -f "${pidfile}" ] && pgrep -F ${pidfile} -q;


>  run_rc_command "$1"
>
>


-- 
Mathieu Arnold


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/svn-ports-head/attachments/20161030/505037ec/attachment.sig>


More information about the svn-ports-head mailing list