pcp
[Top] [All Lists]

Re: Patch to allow upgraded pcp to stop old pmcd

To: Michael Newton <kimbrr@xxxxxxx>
Subject: Re: Patch to allow upgraded pcp to stop old pmcd
From: Nathan Scott <nscott@xxxxxxxxxx>
Date: Wed, 18 Jul 2007 10:51:15 +1000
Cc: pcp@xxxxxxxxxxx
In-reply-to: <Pine.SGI.4.58.0707171230070.25651174@snort.melbourne.sgi.com>
Organization: Aconex
References: <Pine.SGI.4.58.0707171230070.25651174@snort.melbourne.sgi.com>
Reply-to: nscott@xxxxxxxxxx
Sender: pcp-bounce@xxxxxxxxxxx
On Tue, 2007-07-17 at 12:43 +1000, Michael Newton wrote:
> Nathan has previously pointed out that if you install the 2.7.1
> over an existing installation (eg rpm -U), the new /etc/init.d/pcp
> cannot stop a pre-existing instance of pmcd. This was an oversight with
> the pidfile change. While Nathan proposed just adding a fallback to
> killall for this case, this was a problem for us as we have a build system
> (based on SuSE's) for building in a chroot, and the killall means removing
> the rpm from the chroot stops pcp for the whole machine. Although it would
> be preferable to uninstall --noscripts, getting this change through SuSE
> could take time, so for now, this patch assumes that if there is a pmcd,
> but no pidfile or log file, we're in a chroot. In addition, there is now
> a check that the pid in the pidfile matches that found for pmcd

Yeah.  What a sad and sorry tale. :)

> 
> --- a/mgmt/pcp/src/pmcd/rc_pcp  2007-07-17 12:30:43.000000000 +1000
> +++ b/mgmt/pcp/src/pmcd/rc_pcp  2007-07-12 11:59:39.045688455 +1000
> @@ -382,14 +382,44 @@
>         return 0
>      fi
> 
> +    # if pmcd is running but we can't find a pidfile, or a logfile at the
> +    # configured or default location, assume chroot
> +    #
> +    logf=`_pmcd_logfile`
> +    [ -f $logf ] || logf=$RUNDIR/pmcd.log
> +    if [ ! -f $PCP_RUN_DIR/pmcd.pid -a ! -f $logf ]
> +    then
> +       echo "Process ..."
> +       cat $tmp.tmp

The pid should probably be printed on the same line, I'll send a
followup patch to tidy that up.

> @@ -471,7 +501,7 @@
> 
>    'start'|'restart')
>         _get_pids_by_name pmcd >$tmp.tmp
> -       [ -s $tmp.tmp ] && _shutdown
> +       [ -f $PCP_RUN_DIR/pmcd.pid  -o -s $tmp.tmp ] && _shutdown

Hmm - in the case where pmcd is running, we now end up calling
_get_pids_by_name twice (since _shutdown does it too now)... we
can really just call "_shutdown" here now, always, I think ...
but, thats independent cleanup as well.  I've included that in
the followup patch (attached).

cheers.

--
Nathan

Attachment: diff
Description: Text Data

<Prev in Thread] Current Thread [Next in Thread>