tomcat定时任务



# ====== tomcat_shutdown.sh 关闭
#!/bin/sh
export JAVA_HOME=/home/oracle/jdk1.7.0_67/
export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
echo "========begin stop the tomcat========"
'/home/oracle/apache-tomcat-7.0.29/bin/shutdown.sh'


# ====== tomcat_shutdown.sh 启动
#!/bin/sh
export JAVA_HOME=/home/oracle/jdk1.7.0_67/
export CLASSPATH=$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
echo "========begin start the tomcat========"
'/home/oracle/apache-tomcat-7.0.29/bin/startup.sh'


# ====== 定时任务
直接编辑/etc/crontab 文件,即vi /etc/crontab,添加相应的任务。
01 03 * * * /home/oracle/auto_exec/tomcat_shutdown.sh
03 03 * * * /home/oracle/auto_exec/tomcat_startup.sh

转载于:https://my.oschina.net/u/3484168/blog/899900

你可能感兴趣的:(tomcat定时任务)