Fwd: Re: [CC-1009] Update

Dan Rollo <[email protected]> Sat, 12 Feb 2011 03:28:25 -0500
Newsgroups gmane.comp.java.cruise-control.devel
Message-ID <[email protected]>
Hi John,

Just found your email with some script changes, but my shell script 
skills are limited. The last email I saw from you had the following:

http://thread.gmane.org/gmane.comp.java.cruise-control.devel/12643/focus=12679

From: John Patrick <nhoj.patrick <at> gmail.com>
Subject: Re: Getting a Patch Included [CC-1009]
Newsgroups: gmane.comp.java.cruise-control.devel
Date: 2010-12-19 12:46:07 GMT (7 weeks, 5 days, 19 hours and 11 minutes ago)

Take 2... my fault.

I was testing it on MacOSX, but indirectly using the example script below.

I tried it;
without a cc.pid
with an empty cc.pid
invalid pid in cc.pid
valid pid for bash in cc.pid

----
#!/usr/bin/env bash

## single instance per cc.pid
# 1) use ${CC_PID} is already defined
# 2) default ${PID} to -1 and attempt to read pid from ${CC_PID}
# 3) check ${PID} is not stale
if [ ! "${CC_PID}" ]; then
     CC_PID=cc.pid
fi
PID_INVALID="000000"
PID=${PID_INVALID}
if [ -f "${CC_PID}" ]; then
     PID=`head -1 ${CC_PID}`
     if [[ ${PID} != *[[:digit:]]*  ]]; then
         PID=${PID_INVALID}
     fi
fi
RUNNING=`ps -ef | grep "${PID}" | grep -v grep | grep bash | wc -l | sed 
"s| ||g"`
if [ "${RUNNING}" != "0" ]; then
     echo "CruiseControl already running"
     exit -1
fi

EXEC="echo hello"
echo $EXEC
$EXEC &
echo $! > ${CC_PID}
cat cc.pid
-----

John
-------------------------------


I noticed a few differences between that email and the latest patch 
attached to the JIRA CC-1009:

1. The new PID_INVALID="000000" (cool, and I also would change the comment:
# 2) default ${PID} to 000000 and attempt to read pid from ${CC_PID}


2. The check between:
if [ -f "${CC_PID}" ]; then
and...
RUNNING=`ps -ef | grep "${PID}" | grep -v grep | grep bash | wc -l | sed 
"s| ||g"`


I'm not really sure which script you're intending to be used (and/or if 
the snippet changes in the latest email where just for testing). Could 
you please build a new patch with the "real" script logic and attach it 
to the JIRA?

Thanks!
Dan




-------- Original Message --------
Subject: Re: [CC-1009] Update
Date: Thu, 13 Jan 2011 23:22:44 -0500
From: Dan Rollo <[email protected]>
To: [email protected]

Hi John,

I just tried the below lines in a shell on linux:

dan@ubuntudan:~/devtools/cc-new/cruisecontrol$ set PID=-1
dan@ubuntudan:~/devtools/cc-new/cruisecontrol$ ps -ef | grep ${PID} |
grep -v grep | grep cruisecontrol | wc -l | sed "s| ||g"
Usage: grep [OPTION]... PATTERN [FILE]...
Try `grep --help' for more information.
0


I thought I remember you changing something so the script would not use
the -1 default? Was that just an email discussion? If so, apologies, but
could you attach a new diff to the jira (or just remind me what you
changed...whatever you prefer).

Thanks,
Dan


Message: 5
Date: Thu, 13 Jan 2011 21:34:18 +0000
From: John Patrick <[email protected]>
Subject: [Cruisecontrol-devel] [CC-1009] Update
To: cruisecontrol-devel <[email protected]>
Message-ID:
	<[email protected]>
Content-Type: text/plain; charset=UTF-8

Any update of testing of patch?

John

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb