watchdog

迅为-IMX6开发板-QtE-watchdog看门狗例程

强颜欢笑 提交于 2019-12-17 22:22:55
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 本节介绍的是在 linux 系统环境下看门狗测试例程。WatchDog 是为了能够防止程序跑飞 而使用的一种东西,用户在一般的程序也许不需要,但在特殊的情况下可能会需要这种机制。 在此我们将介绍看门狗实验调试步骤。 看门狗驱动飞思卡尔已经做好,只需要我们调用即可,设备节点为 “/dev/watchdog”,如下图所示。 将“watchdogtest”(在压缩包中)拷贝到开发板,使用命令“chmod 777 watchdogtest”修改权限,然后使用命令“./watchdogtest”,即可开启看门狗,并每秒喂狗 1 次,持续 10 秒,停止喂狗之后开发板就会重启。 来源: oschina 链接: https://my.oschina.net/u/3005926/blog/3102199

STM32系列 STM32F4xx 独立看门狗(IWDG)

不打扰是莪最后的温柔 提交于 2019-12-17 21:52:32
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 0 前言     由于单片机的工作常常会受到来自外界电磁场的干扰,造成各种寄存器和内存数据混乱,会导致程序指针错误,不在程序区,取出错误的程序指令等,都会陷入死循环,程序的正常运行被打断,由单片机控制的系统无法正常工作,会造成整个系统陷入停滞状态,发生不可预料的后果。 1 简介     STM32F4xx具有两个看门狗外设,均可用于检测并解决由软件错误导致的故障,当计数器达到给定的超时值时,触发一个中断(仅适用于窗口型看门狗)或产生系统复位。     独立看门狗(IWDG)由其专用的低速时钟(LSI)驱动,因此,即便在主时钟发生故障时仍然保持工作状态。窗口看门狗(WWDG)时钟由APB1时钟经预分频后提供,通过可配置的时间窗口来检测应用程序非正常的过迟或过早的操作。     LSI RC 可作为低功耗时钟源在停机和待机模式下保持运行,所以,在MCU进入停机或待机模式时,看门狗仍能正常运行,所以需要定时唤醒喂狗,否则,MCU复位重启。     独立看门狗适用于那些需要看门狗作为一个在主程序外,能够完全独立工作,并且对时间精度要求较低的场合。窗口看门狗适合那些要求看门狗在精确计时窗口起作用的应用程序。 2 独立看门狗特性 自由运行递减计数器 时钟由独立RC振荡器提供(可在待机和停止模式下运行)

how to use linux software watchdog

元气小坏坏 提交于 2019-12-17 15:44:24
问题 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. 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. 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 回答1: Most of

The Why and the How of Creating a Watchdog in Cocoa/Objective-C

白昼怎懂夜的黑 提交于 2019-12-12 08:16:16
问题 Happy Monday to you all! Here is my situation. Any assistance greatly appreciated! I have created an executable that when installed gets placed in the Launch Agents folder of the machine. In theory it should run perpetually, collecting data every second. It can stop when the machine is asleep, but restart when the computer is reactivated. Here is my problem: sometimes the program just spontaneously stops , usually after a couple of days of running. If one restarts the computer then the

How to delete Files / Directories after Subprocess is done with them?

笑着哭i 提交于 2019-12-11 21:52:08
问题 I am using Watchdog to monitor a directory. If any new directories are added, I want to start subprocesses on those "Source" directories and call a program anon_local on the directories which will output some files. My question is: What would be an elegant way of deleting the directories and their content after my subprocesses are done with that directory? class Handler(FileSystemEventHandler): @staticmethod def on_any_event(event): if event.is_directory and event.event_type == 'created':

How to do notifications with Python 3.3?

老子叫甜甜 提交于 2019-12-11 11:17:24
问题 I'm working on a python app that needs a notification when there's a change in a directory structure; e.g., someone drops a file in a folder or changes a file name. Reading up on Watchdog, it looks like it does just what I need except that I'm working in Python 3.3 and Watchdog doesn't seem to have been updated. Below is the tail end of an error dump from a watchdog sample file. File "C:\Program Files\Python33\lib\site-packages\watchdog-0.6.0-py3.3.egg\watchdog\utils\bricks.py", line 112, in

Systemctl dependency failure, stop dependent services

眉间皱痕 提交于 2019-12-11 04:29:33
问题 I have 2 services a.service and b.service. a.service is shown [Unit] Description=My service [Service] Type=forking ExecStart=/bin/sh /home/admin/run.sh Restart=on-failure [Install] WantedBy=multi-user.target, b.service [Unit] Description=My service [Service] Type=forking ExecStart=/bin/sh $HOME/theFolder/run.sh Restart=on-failure [Install] WantedBy=multi-user.target Now, when i start b.service, i'm sure a.service will be started. During runtime, suddenly someone messes with /home/admin/run.sh

Python (Watchdog) - Waiting for file to be created correctly

余生颓废 提交于 2019-12-11 02:47:53
问题 I'm new to Python and I'm trying to implement a good "file creation" detection. If I do not put a time.sleep(x) my files are elaborated in a wrong way since they are still being "created" in the folder. (buffer is not empty) How can I circumvent this thing without waiting x seconds every time a file is created? This is my code: Main: while 1: if len(parser()) > 0: # arguments are valid if len(parser()) == 3: log_path = parser()['log_path'] else: log_path = os.getcwd() paths = parser() if

原   Android中ANR的监测与定位

余生颓废 提交于 2019-12-09 21:18:38
一、原理 1. ANR监测原理 判断ANR的方法其实很简单,我们在子线程里向主线程发消息,如果过了固定时间后,消息仍未处理,则说明已发生ANR了。 看懂了直接看2,没看懂继续看。 Android应用程序的所有交互操作和响应,都是通过主线程的消息机制来进行的。例如当用户点击了某个Button,系统会向主线程发送消息,主线程的Looper从主线程消息队列中取出消息并处理,处理完当前消息,主线程Looper再去取出下一个消息。当主线程做了耗时的任务,主线程的Looper就无法从消息队列中取出新的消息,所表现出的就是程序卡顿,甚至是ANR。同理,我们在子线程往主线程发送一个消息,要是消息无法得到及时处理,那说明程序发生ANR了。 2. 定位耗时操作的原理 当程序ANR后,我们可以通过主线程Looper拿到主线程Thread,然后通过getStackTrace拿到主线程当前的调用栈,从而定位到发生ANR的地方,定位到耗时操作。 二、代码实现 1. 首先我们定义一个线程,用来监测主线程。 在该线程中,我们首先给主线程发送消息,然后睡眠指定时间,之后监测消息是否被处理,若未被处理,则抛出ANR异常。 为什么叫ANRWatchDog:了解嵌入式的人对看门狗应该很熟悉,在嵌入式中,看门狗定时器在程序跑飞时,可定时复位程序,而我们必须定期喂狗(将定时器清零),表示程序正常运行。

Monitoring a single file

和自甴很熟 提交于 2019-12-07 02:05:19
问题 I need to monitor (using watchdog) a single file, not a whole directory. What is the best way to avoid monitoring a whole directory? I suppose this class watchdog.events.PatternMatchingEventHandler(patterns=None, ignore_patterns=None, ignore_directories=False, case_sensitive=False)[source] could be helpful, but how to define an appropriate pattern for my file ( C:/dir1/dir2/file.txt) ? 回答1: If you want to watch a file path like C:/dict1/dict2/file.txt , I think that's your pattern right there