autoRelease.sh
#!/bin/sh /home/tomcat/bin/shutdown.sh echo "tomcat stoped" cd /home/tomcat/webapps rm -rf DETECT-X/ DETECT-X.war wget http://192.168.1.42/DETECT-X.war /home/tomcat/bin/startup.sh
war包可以放在支持web访问的地方,比如 tomcat、hfs
cron 定时任务
[root@localhost tmp]# crontab -e //这里是编辑 crontab: no changes made to crontab [root@localhost tmp]# crontab -l //查看 32 16 11 3 * /bin/sh /root/tmp/autoRelease.sh >/dev/null 2>&1
command 后面必须加 >/dev/null 2>&1
注意系统时间:
[root@localhost tmp]# date Mon Mar 11 16:32:00 CST 2019 [root@localhost tmp]# date Mon Mar 11 16:32:01 CST 2019 [root@localhost tmp]# crontab -l 32 16 11 3 * /bin/sh /root/tmp/autoRelease.sh >/dev/null 2>&1
参考:
https://blog.51cto.com/oldboy/1410555