Script to monitor JBoss web server

Hello All,

I need a shell script to monitor JBOSS web server.If the JBOSS web server is down, then the script should send a mail.

Please help on this.

Regards,
Sachin

Normally this is done with a crontab file.

Your script will look something like this pseudo code:

ps -aux| grep <name_of_jboss_process>| grep -v grep > /dev/null

echo $?

if $? == 1 jboss is down do something  (like restart it and send email)

else jboss is OK, do nothing.

Your exact ps command is platform dependent.

Use twiddle.sh, located in $JBOSS_HOME/bin. call with something like:
if twiddle.sh --server=$SOMESERVER -u $ADMIN_USER -p $ADMIN_PSW get jboss.system:type=ServerInfo 2> /dev/null 1>&2
then
echo "jboss is fine"
else
echo "jboss is broke"
fi