View Single Post

  #1 (permalink)  
Old 05-01-2008, 01:52 PM
kasimani kasimani is offline
Member
User
 
Join Date: Jul 2006
Posts: 78
Rep Power: 0
kasimani
Send a message via Yahoo to kasimani
Default Tomcat shell script cron job to restart server

i am suffering through a shell script prob. when i am running my shell script using "sh" it is working fine, but when i put that file inn crontab, it's stops running.
i am giving u my script, actually this script will stop and aging restart the tomcat server.

if [ `netstat -nlp | grep :3128 | wc -l` = 1 ]; then
{
echo live
kill -9 `ps -ef|grep java|awk '{print $2}'`
}
fi
sleep 5
cd /usr/local/apache-tomcat-6.0.13/
sh ./bin/startup.sh > err.txt


in err.txt i got this message

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program



i just check the startup.sh script i found that is starting with

#!/bin/sh

is this a problem, well i am inn /bin/bash, but this doesn't helped me out.

pl. help me out of this problem

Thanks in Advance

Last edited by kasimani; 05-02-2008 at 12:23 PM.. Reason: symble
Reply With Quote