일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 완속충전기
- 보안
- STM32
- 플라스크
- 홈어시스턴트
- dynamodb
- 라즈베리파이
- homeassistant
- 펌웨어
- flask
- 전기차충전
- 디자인패턴
- raspberry
- OCPP
- 파이썬
- esp8266
- 에버온
- 전기차
- 전기차충전기
- 급속충전기
- 안드로이드
- lambda
- AWS
- everon
- IOT Core
- thread
- Android
- 서버리스
- YMODEM
- 충전기
Archives
- Today
- Total
Louie NRT Story
[Raspberry Pi] Watchdog 본문
반응형
Writed on 28 OCT 2019
Device: Raspberry Pi 3
Raspbian Version: 2019-09-26-raspbian-buster-full.zip
1. Install Watchdog
2. Start service
- This service shows create or modify log at this current directory.
3. Start programming
import sys
import time
import logging
from watchdog.observers import Observer
from watchdog.events import LoggingEventHandler
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO,
format='%(asctime)s - %(message)s',
datefmt='%Y-%m-%d %H:%M:%S')
path = sys.argv[1] if len(sys.argv) > 1 else '.'
event_handler = LoggingEventHandler()
observer = Observer()
observer.schedule(event_handler, path, recursive=True)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()
- This program shows create or modify log at this current directory.
Reference: https://github.com/gorakhargosh/watchdog
반응형
'에너지' 카테고리의 다른 글
[Raspberry Pi] Subprocess(Run new process) (0) | 2019.10.28 |
---|---|
[Raspberry Pi] Supervisor (0) | 2019.10.28 |
[Raspberry Pi] Change booting image and remove log (0) | 2019.10.23 |
[Raspberry Pi] Initialization on Raspberry Pi (0) | 2019.10.23 |
[Raspberry Pi] Install Raspbian on Raspberry Pi (0) | 2019.10.23 |
Comments