Posts

Showing posts from May, 2013

Jar relocation to avoid conflicts

Logging builds and tests on linux

I like to keep a history of various operations so that I can compare them over time and with other systems.


START_TIME=`date +%s`
echo `date` 'building app' >> ~/bin/buildTiming.txt

#Do the build, deployment, tests, or whatever
echo `date` 'done building app ' $(echo `date +%s` - $START_TIME | bc) >> ~/bin/buildTiming.txt

Launch JConsole auto connect

jconsole `ps aux | awk '/[a]ctivemq-5.8/ {print $2}'`

For the layperson that doesn't speak geek, full explanation of the syntax below:

` ` back-quotes delineate commands which are evaluated first so the result(s) are passed instead
ps aux lists all running processes in user friendly format, pid in second column
| pipes the output of the previous command to the input of the following command
awk parses the ps output - don't need grep - SO
' ' single-quotes delineate instructions to awk
/ / foreslashes delineate a regex evaluation in awk
[a] sneaky use of regex to eliminate regex returning both activemq and awk pid from ps output - SO
{ } braces delineate awk actions
print $2 prints the 2nd column of the ps output