核心转储后自动重新启动应用程序
我有一个 Linux 进程,但有时我会进行一些核心转储。
简单的问题:是否有任何方式/方法/程序/任何能够重新启动 被杀死的进程?
谢谢。
I have a linux process but I am taking some core dumps some times.
Simple question: Is there any way/method/program/whatever that is capable of restarting a
process that got killed?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以将进程的执行包装在 shell 脚本中,该脚本将在应用程序退出时继续重新启动应用程序。
You could wrap the execution of the process in a shell script that would simply keep restarting the app as it exits.
您可以使用 monit。
You can use monit.
除了 Soo 提到的之外,请确保您拥有可靠的通知机制,以便您知道您正在频繁重新启动。
考虑使用重新启动计数器,并在重新启动过于频繁或次数过多时停止重新启动。如果你只是崩溃,重新启动并立即再次崩溃,这通常是一件非常糟糕的事情。
In addition to what Soo mentioned, ensure you have a reliable notification mechanism so that you know you're getting frequent restarts.
Consider having a restart counter and stop restarting if you restart either too frequently or too many times. If you're just crashing, restarting and instantly crashing again that's usually a pretty bad thing.