Skip to content

Instantly share code, notes, and snippets.

@codingmiao
Last active February 9, 2017 01:35
Show Gist options
  • Save codingmiao/83f59c5a6fbb2ce30c4fd06a9fcfa225 to your computer and use it in GitHub Desktop.
Save codingmiao/83f59c5a6fbb2ce30c4fd06a9fcfa225 to your computer and use it in GitHub Desktop.
1、编写脚本restart.sh
/usr/local/tomcat/bin/catalina.sh stop
sleep 1m
/usr/local/tomcat/bin/catalina.sh start
2、上传脚本到服务器,修改权限
执行测试 /usr/local/tomcat/bin/restart.sh
如果sleep出错,运行
dos2unix restart.sh
可能要安装 dos2unix
3、可能要安装 crontab
运行crontab -e命令
按i进入编辑
输入
30 03 * * * /usr/local/tomcat/bin/restart.sh
按esc退出,输入:wq!保存(ssh貌似有时不行,可以直接paste :wa!进去来保存退出)
4、
[root@]# service crond stop
[root@]# service crond start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment