A Developer's Diary

Apr 4, 2008

Java - Debugging In Tomcat 5.5

Steps to be followed to enable debugging in Tomcat 5.5 through Eclipse

Configuring Tomcat
1. Go to configure options in Tomcat5.5
2. Select Tab "Java" and in Java Options add the following lines
-Xdebug
-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=8000

Configuring Eclipse
1. Click on Debug
2. Select Remote Java Application
3. In connection properties add host and Port = 8000
4. Add break point

Happy Debugging :)
Read more ...

Apr 3, 2008

Shell Scripting - Parallel Process Execution in Background

Command for checking the background jobs which are in running state

jobs -r | wc -l


Non-interactive ftp transfer to automate uploading of files parallely on different platforms.

#!/bin/bash

LINUX=linux
AIX=aix
SUNOS=sunos

WIN32=win

MACHINES=" \
    $LINUX \
    $AIX \

    $SUNOS \
    $WIN32"

function checkjobs(){
if [ `jobs -r | wc -l` -eq 0 ]; then

echo "All Background Process completed Successfully"
return 0
fi
sleep 10

checkjobs
}

function upload(){

if [ $# -eq 0 ]; then

echo "Missing Argument"
exit 1
fi

# Non-interactive ftp transfer
ftp -i -v -n hostname <<END_FTP

    user root root
    binary
    cd test
    put "file$1.exe"
    bye

END_FTP
echo "Uploaded file$1.exe"
return 0
}

function uploadfile(){
echo "Uploading Files  Started"
for host in $MACHINES

do
echo "Uploading FILES on host $host"
upload $host &
done

}

uploadfile
checkjobs
echo "All Files Uploaded Successfully"





Making things more simpler, we can use the special command wait and rewrite uploadfile so that we need not check for the background processes

function uploadfile(){
echo "Uploading Files  Started"

for host in $MACHINES
do
echo "Uploading FILES on host $host"

upload $host &
done
wait
}

uploadfile
echo "All Files Uploaded Successfully"





Read more ...