View Single Post

  #5 (permalink)  
Old 05-03-2008, 08:46 PM
nixcraft's Avatar
nixcraft nixcraft is offline
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,060
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

You can add variable to /etc/crontab

Code:
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/java/jdk1.5.0_07/bin
MAILTO=root
HOME=/home/admin/
JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java
Alternatively, add it your script itself
Code:
#!/bin/bash
export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
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
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote