From b27c1bc623b6efea77c84d92e96f512e0fc66cd2 Mon Sep 17 00:00:00 2001 From: Thomas Oettli Date: Mon, 2 Nov 2020 16:22:33 +0100 Subject: [PATCH] extend README.md --- README.md | 25 +++++++++++++++---------- docs/.config.py.swp | Bin 0 -> 12288 bytes pyinotifyd.py | 6 +++--- 3 files changed, 18 insertions(+), 13 deletions(-) create mode 100644 docs/.config.py.swp diff --git a/README.md b/README.md index 474d4e6..5720087 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ # pyinotifyd -A daemon to monitore filesystems events with inotify on Linux and execute tasks, which can be Python functions or shell commands. +A daemon to monitore filesystems events with inotify on Linux and execute tasks, which can be Python functions or shell commands. It is build on top of the pyinotify library. -## Dependencies +## Requirements * [pyinotify](https://github.com/seb-m/pyinotify) ## Installation @@ -16,16 +16,21 @@ The config file is written in Python syntax. pyinotifyd reads config options fro This is the default configuration: ```python pyinotifyd_config = { + # List of watches, description below "watches": [], + # Set the loglevel (see https://docs.python.org/3/library/logging.html#levels) "loglevel": logging.INFO, + # Set the timeout to wait for pending tasks to complete during shutdown "shutdown_timeout": 30 } ``` - -Global options: -* **watches** - List of Watches, description below. -* **loglevel** - Set the loglevel, you may use every available loglevel of the Python logging framework. -* **shutdown_timeout** - Timeout to wait for pending tasks to complete when shutdown. +## Watch configuration +A Watch is defined as a dictionary which contains the config options: +```python +{ + "path": "/tmp", + "rec": True, + "auto_add": True, + "event_map": {} +} +``` diff --git a/docs/.config.py.swp b/docs/.config.py.swp new file mode 100644 index 0000000000000000000000000000000000000000..5b59b1cee34dc91a1f115d5bcf298fdd4ace6f22 GIT binary patch literal 12288 zcmeI2&2Jk;7>6f4Aie@96{o7wbbYZ=@aBWk5@D*4tdYU?7TalBm9pCG&e~gccdVUp z63Ya*K*f$?y;{+#=_$N3}kSKpb)!*9d#7!OBQcsm;r6;?ddG~#1o|&~| zWp|dYlq&RMeudz8j*x%uer2`({&Vh+y;FqC7EhX|9ZpMlB6xA-!i9d86T?4966&rk zZN2GBz1{UAE`6`->MnPL?(oR-oB4M4#008C8Bhiu!oWOPU0GgA5@fV<^z_2kL*!Do zDg(-ZGN2471ImChpbRJj%D|&$K(^<|hZyv!bl{iL^W3p>`ca*f0cAiLPzIC%Wk4BF z29yD1Kp9X5lmTVn5j0@CguL`PA>}79c>Mo=`1}9gXYnoo_zipsx?mq{gR|fa`2QI~ z?tuTm58xy4CMbcIK@QA=+w+9{0=@^|fp5Vr@Co=BSl|_K8Z3aHpC;rd@FVyfbip-n z6|4gtJP+h$lrEn?AcNk3Hv_iI0<_|?=||0c zsaiA_2i-T)bCM{%Bf0D!TB&MnRV(IJwSk*O-mxQx1>>ULw#+L=tyng<5m@CB8_9Z@ z%Dik;Cv;bkV$*7v{ZhhdF}D+p%`*rr*38PtsKymc05hvSt?$elBo1X)vOtt z6VhxNWutLeY^ZA7pazjs3U1Vl^@cH_-bUH18`gHM)Q=MRNxlZLRdX19()z478nx2v z6N;{HY#86Eq(0-j{j$Y%n25<1v0`1`i!^uZ7EMwme+X16T8EBe;W~Sbc3IdhtEfxgz zbbrQKCv*#%-Vw1LaK{ex9Y4~gE#AwE7VU+&i0qIZ&|WgF^isr*b@)-sO&$4QUZdmh z2)oHB_l^yQPM<}ZE1gRN<2#y)%L2PwSYBGBH~CJ%3-dVT2*lt|vYaU=gz8GHu zqJTyBLbxyb0jt;%CLd>K)OLJRjMaFb2fF9W)@Z4jwLVa52F*@KNFG{4)rpJY*R&sb zJnLz_WII{Dd$2~?K65&f(WHfXJf^+=lXrkklyR9ykCJ8k9gF=)+?!jQP1g)|X53?_ Vcdq|fBo73OcJa*NUHoX3+yg82=CuF- literal 0 HcmV?d00001 diff --git a/pyinotifyd.py b/pyinotifyd.py index 8aef052..61f0256 100755 --- a/pyinotifyd.py +++ b/pyinotifyd.py @@ -67,11 +67,11 @@ class Task: class TaskScheduler: - def __init__(self, job, delay=0, files=True, directories=False, + def __init__(self, job, delay=0, files=True, dirs=False, logname="TaskScheduler"): self._delay = delay self._files = files - self._directories = directories + self._dirs = dirs self._job = job self._tasks = {} self._log = logging.getLogger(logname) @@ -86,7 +86,7 @@ class TaskScheduler: path = event.pathname maskname = event.maskname.split("|", 1)[0] if (not event.dir and not self._files) or \ - (event.dir and not self._directories): + (event.dir and not self._dirs): return if path in self._tasks: