Tomcat启动:
shell脚本调度tomcat时,必须将java home添加到环境变量中,否则无法调用成功
#!/bin/bash
export JAVA_HOME=/usr/lib/jvm/jdk1.8.0_231
echo "The execute stime is:"`date` >> execute.log
sh /root/apache-tomcat-7.0.94/bin/startup.sh
Tomcat停止:
用tomcat自带的shutdown.sh有时不起作用,采用杀进程的方式比较稳妥
#!/bin/bash
echo "The execute etime is:"`date` >> execute.log
ps -ef | grep /root/apache-tomcat-7.0.94/bin | grep -v grep | awk ‘{print $2}‘| xargs kill
原文地址:https://www.cnblogs.com/renzy194/p/12024871.html
时间: 2024-11-09 21:36:12