linux - 如果 Linux 进程失败或崩溃,自动重新启动它

标签 linux bash process scripting

我有一个基于 linuxOS 的系统。如果可执行 bin 文件被终止或崩溃,我想重新启动它。

可执行文件在 home/bin/filename 中的位置 我有 etc 目录,其中有 init.d 、systemd、cron sun-directories 。

请建议编写任何脚本,以便 bin 文件在崩溃时重新启动。

最佳答案

尝试 restartd 包。

Restartd is a daemon for checking running and not running processes. It reads the /proc directory every n seconds and does a POSIX regexp on the process names. You can execute a script or a program if the process is or is not running.

您可以设置观看什么进程、时间间隔等。

关于linux - 如果 Linux 进程失败或崩溃,自动重新启动它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41584395/

相关文章:

c# - 从 Windows 服务运行命令行 exe

c++ - ms c++获取当前进程的pid

linux - Perl Tk : When calling external scripts, 如何防止其他按钮被点击?

linux - 来自 shell 脚本内部的 nohup 命令阻止脚本执行

linux - 如何遍历 shell 命令的输出?

bash - 使用 env 为子 shell 设置变量有优势吗?

c - 5叉后只有1个 child (C)

linux - Linux 中的 git 和硬链接(hard link)

linux - sed -n 创建一个文件扩展名为 'n' 的新文件

linux - 在终端/Linux 上查找包含特定日期范围文件名的所有文件