watchdog

combining python watchdog with multiprocessing or threading

梦想与她 提交于 2019-12-31 23:25:13
问题 I'm using Python's Watchdog to monitor a given directory for new files being created. When a file is created, some code runs that spawns a subprocess shell command to run different code to process this file. This should run for every new file that is created. I've tested this out when one file is created, and things work great, but am having trouble getting it working when multiple files are created, either at the same time, or one after another. My current problem is this... the processing

python watchdog monitoring file for changes

 ̄綄美尐妖づ 提交于 2019-12-28 07:39:27
问题 Folks, I have a need to watch a log file for changes. After looking through stackoverflow questions, I see people recommending 'watchdog'. So i'm trying to test, and am not sure where to add the code for when files change: #!/usr/bin/python import time from watchdog.observers import Observer from watchdog.events import LoggingEventHandler if __name__ == "__main__": event_handler = LoggingEventHandler() observer = Observer() observer.schedule(event_handler, path='.', recursive=False) observer

单片机如何才能不死机之内外部时钟

随声附和 提交于 2019-12-25 10:36:09
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 1. 前言 时钟是嵌入式系统中非常重要,但又常常被忽视的地方。它的成本只占整个系统的一个零头,但由于时钟的停振,或其它异常最终导致厂商付出高昂代价的案例却并不少见。下面我们看一下在时钟设计中应该注意的一些问题。 2. 寄存器配置 现在单片机一般会支持四种时钟工作模式:内部低频时钟,内部高频时钟,外部低频时钟,外部高频时钟。低频时钟一般可经由单片机内部的锁频环倍频到高频时钟。(为啥这么折腾,不直接用高频时钟呢?a. 用的最多的32.768 kHz 低频时钟,经过15次分频后正好是1 Hz,可以准确的计时。b. 低频时钟功耗更低。c. 提高EMC性能。在低频时钟被瞬间干扰掉几个振荡周期的情况下,锁频环 (FLL) 仍能保证输出稳定,程序运行不受影响。) 一般单片机上电后默认工作在内部时钟,需要通过寄存器配置切换到其它时钟模式。这里需要注意,需要通过查询监控寄存器状态,来确认时钟工作模式。在实际项目中确实发生过电路板上加了外部晶振,但由于寄存器配置错误,系统仍工作在内部时钟的情况。如果配置中有不同的增益模式 (High Gain, Low Gain, or High Drive, Low Drive),要注意在不同模式下,单片机内部时钟电路对外部时钟具有不同的驱动能力。以STM32F030R8为例,在LSE 的Low

How Callback is maintained from Userspace to Kernel Space

做~自己de王妃 提交于 2019-12-25 01:45:28
问题 I am learning about the driver and looking into the watchdog driver code where some value is being written to /sys/devices/virtual/wdc_per now I guess this is the logic how driver gets its value from userspace and exposed file in user space is "sys/devices/virtual/wdc_per" But now how actually this value from wdc_per is reached to driver, there must some callback maintained In My case its GPIO based Watchdog driver and gpio_wdt.c may be having this callback. But I really could not figure out

watchdog in vc++ application

半腔热情 提交于 2019-12-24 03:30:55
问题 I have written a simple vc++ background application. What am trying is like a watchdog service that could monitor if the application is running or not. If the application crashed then the service should start the application For creating a setup through windows installer am using only the app.exe and app.dll. Is that possible to create this watchdog - service in the exe itself ? Unfortunately I have no idea of how to write such a program, does anyone have some example code that would

Crash reporting watchdog for when my application locks up on a customer's machine

半世苍凉 提交于 2019-12-22 09:18:40
问题 I'm working with a somewhat unreliable (Qt/windows) application partly written for us by a third party (just trying to shift the blame there). Their latest version is more stable. Sort of. We're getting fewer reports of crashes, but we're getting lots of reports of it just hanging and never coming back. The circumstances are varied, and with the little information we can gather, we haven't been able to reproduce the problems. So ideally, I'd like to create some sort of watchdog which notices

Retrieving return address of an exception on ARM Cortex M0

老子叫甜甜 提交于 2019-12-21 18:58:34
问题 I am trying to retrieve the return address of an IRQ handler in my code. My aim is to save the value of the PC just before the watchdog timer expires and before the reset for debug purposes, using WDT_IRQHandler(). I am also testing this approach with other IRQs to check if I grasped the idea. But it seems I haven't. I have read the documentation available. I understood that when an exception happens, 8 registers are pushed to the stack: R0, R1, R2, R3, R12, LR, PC and XPSR. I have also read

Linux automatically restarting application on crash - Daemons

佐手、 提交于 2019-12-20 14:22:30
问题 I have an system running embedded linux and it is critical that it runs continuously. Basically it is a process for communicating to sensors and relaying that data to database and web client. If a crash occurs, how do I restart the application automatically? Also, there are several threads doing polling(eg sockets & uart communications). How do I ensure none of the threads get hung up or exit unexpectedly? Is there an easy to use watchdog that is threading friendly? 回答1: The gist of it is:

Detect file creation with watchdog

北城余情 提交于 2019-12-20 10:25:09
问题 I am trying to detect when a file with a given name is created in a directory. I am doing it thanks to watchdog. The creation is correctly detected but I don't know how to terminate the application properly once the detection is done. My piece of code is the following: #!/usr/bin/env python # -*- coding: utf-8 -*- import logging import sys import time from watchdog.events import FileSystemEventHandler from watchdog.observers import Observer logging.basicConfig(level=logging.ERROR) class

python watchdog modified and created duplicate events

眉间皱痕 提交于 2019-12-18 06:55:46
问题 Running on Ubuntu, every time i create a file i get a modified and a created event. Is this by design or am i doing something wrong? I'm using the event handler class PatternMatchingEventHandler event_handler = MediaFileHandler(ignore_directories=True) observer = Observer() observer.schedule(event_handler, path=directory, recursive=True) observer.start() If this is the correct behavior, can i safely ignore the created event? 回答1: Short answer: f = open(... , 'w') generates a FileCreatedEvent