简体   繁体   English

按计划在AWS EC2实例上重新启动Tomcat服务

[英]Restart Tomcat Service on AWS EC2 instance, on a schedule

I have an instance on Tomcat running on EC2. 我在EC2上运行Tomcat的实例。 Based on some resourcing reasons that I don't want to get into, I'd like it to restart each evening at 11:00pm. 根据我不想进入的一些资源原因,我希望每天晚上11点重新开始。 I'm not interested in reloading or stopping the applications context as the PermGen space gets crowded until eventually the box tips over and dies. 我对重新加载或停止应用程序上下文不感兴趣,因为PermGen空间变得拥挤,直到最终盒子翻倒并死亡。

So where on an aws linux instance do I specify service tomcat7 restart and give it a cron expression? 那么在aws linux实例上我指定service tomcat7 restart并给它一个cron表达式?

To add a cronab entry for root user: 要为root用户添加cronab条目:

sudo crontab -e

which will open an editor. 这将打开一个编辑器。 Insert the following line to restart tomcat7 at 11pm daily 插入以下行,每天晚上11点重启tomcat7

0 23 * * * /sbin/service tomcat7 restart

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM