如何使用Linux软件看门狗? [英] How to use Linux software watchdog?

查看:67
本文介绍了如何使用Linux软件看门狗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以告诉我如何在Linux中处理软件看门狗吗?

Can anybody tell me how to handle the software watchdog in Linux?

我有一个程序 SampleApplication ,该程序可以连续运行,如果程序异常挂起或关闭,则需要重新启动它.

I have a program SampleApplication which runs continuously and I need to restart it if its hangs or closes unexpectedly.

我对此进行了谷歌搜索,发现Linux在/dev/watchdog 中具有看门狗,但不知道如何使用它.有人可以帮我举个例子吗?

I was Googling about this and found Linux has watchdog at /dev/watchdog but don’t know how to use it. Could someone help me with an example?

我的问题是我应该在哪里指定我的应用程序名称和重新启动的延迟间隔?

My question is where to I specify my application name and delay interval to restart?

推荐答案

大多数Unix/Linux init 程序将为您管理守护程序并重新启动它们.考虑将服务放置在/etc/inittab 中.或者您可能正在使用 Upstart systemd .

Most of the Unix/Linux init programs will manage daemons for you and restart them. Look into placing your service in /etc/inittab. Or you might be using Upstart or systemd.

所有这些程序都以 PID 1 运行,监视和重新启动系统进程是他们的工作.

All of these programs run as PID 1 and it is their job to monitor and restart system processes.

从您的Busybox标记中,我假设您正在运行嵌入式系统.在这些服务器上,System V风格的初始化脚本及其所有的shell脚本实在是太过分了.您可能应该删除所有内容,并用/etc/inittab 中的条目或upstart或systemd作业中的条目替换.

From your Busybox tag I would assume you are running an embedded system. On those, the System V style init scripts with all of their shell scripts are really overkill. You should probably rip all that out and replace it with entries in /etc/inittab or upstart or systemd jobs.

这篇关于如何使用Linux软件看门狗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆