不停止程序(使用shell脚本)
我有一个名为“mm.out”之类的二进制程序。这个程序有一些意想不到的错误,这些错误导致它停止。我想编写一个服务或 shell 脚本,以便在二进制文件意外停止时再次执行它。我该怎么写这个程序呢?
I have a binary program named as some thing like "mm.out". This program has some unexpected bugs and the bugs causes it to stop. I want to write a service or shell script to execute my binary again if it stopped unexpectedly. How should I write this program?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你应该修复程序。但如果您确实想要这个,请循环运行它:
You should fix the program. But if you really want this, run it in a loop:
让 shell 脚本执行它并等待返回代码,如果该代码不是 0,则重新启动程序。
Let a shell script execute it and wait for a return code, if that code isn't 0 restart the program.