如何使用linux软件看门狗 [英] how to use linux software watchdog
问题描述
您好,有人可以告诉我如何在linux中处理软件看门狗.我有一个程序"SampleApplication",该程序连续运行,如果程序异常挂起或关闭,则需要重新启动它.
Hi can anybody tell me how to handle the software watchdog in linux .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 dont know how to use it.Could someone help me with example.
我的问题是在哪里指定我的应用程序名称和重新启动的延迟间隔.由于我是Linux新手,请尽可能向我介绍示例.谢谢
My question is where to I specify my application name and delay interval to restart . As I am new to linux please brief me with sample if possible. Thanks
推荐答案
大多数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屋!