vim /root/scripts/watchTomcat.sh
#!/bin/sh source /root/.bash_profile /sbin/service tomcat6 status if [ $? -eq 1 ]; then alias mv=mv mv -f /var/log/tomcat6/catalina.out /var/log/tomcat6/crashed_`date '+%Y%m%d%H%M'`.out /sbin/service tomcat6 start fi
chmod +x /root/scripts/watchTomcat.sh
crontab -e
* * * * * /root/scripts/watchTomcat.sh