Thursday, August 25, 2011

Finding and deleting old log files

Occassionally you need to clean up some disk space. The quickest and easiest thing to do is often to look for log files that have been rolled by some other process.

For Example:
find . -name *.log.5 -exec /bin/rm '{}' \;
Of course, you need to understand the naming convention of your logs.  Here's a quick example of finding and removing files with a date appended to the original log name.  This command will remove all the log files for the first 9 days of August 2011.

find . -name *.log.2011-08-0* -exec /bin/rm '{}' \;

Thursday, July 21, 2011

Jython Snippet - Max Heap or All appServers on Node XYZ

#########
#get max heap size for all JVMs on a given node. Must connect to dmgr for this to work
#########
myNode='mw-node-001'
serverList = AdminServerManagement.listServers("",myNode)
for server in serverList:
   serverName=AdminConfig.showAttribute(server,'name')
   maxHeapL=AdminServerManagement.listJVMProperties(myNode,serverName,'maximumHeapSize')
   maxHeap=str(maxHeapL)
   print serverName + " " + maxHeap

Thursday, June 16, 2011

Complete Idiot's Guide To Jython for Noob Dummies

It's been a long time since I have jython'ed.  Here's a tip...

you can't concatenate an integer and a string.  Make sense, but it's a pain for someone that's used to doing a lot of perl/shell type scripting.


if you try something like this:

cntr=1
print "counter is " +cntr
you're going to get an error similar to:
TypeError: __add__ nor __radd__ defined for these operands

So how do you do this?  It's almost too easy:
cntr=1
print "counter is " +cntr.toString()