extend README.md

This commit is contained in:
2020-11-02 16:22:33 +01:00
parent 384d29025e
commit b27c1bc623
3 changed files with 18 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
# pyinotifyd # 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) * [pyinotify](https://github.com/seb-m/pyinotify)
## Installation ## Installation
@@ -16,16 +16,21 @@ The config file is written in Python syntax. pyinotifyd reads config options fro
This is the default configuration: This is the default configuration:
```python ```python
pyinotifyd_config = { pyinotifyd_config = {
# List of watches, description below
"watches": [], "watches": [],
# Set the loglevel (see https://docs.python.org/3/library/logging.html#levels)
"loglevel": logging.INFO, "loglevel": logging.INFO,
# Set the timeout to wait for pending tasks to complete during shutdown
"shutdown_timeout": 30 "shutdown_timeout": 30
} }
``` ```
## Watch configuration
Global options: A Watch is defined as a dictionary which contains the config options:
* **watches** ```python
List of Watches, description below. {
* **loglevel** "path": "/tmp",
Set the loglevel, you may use every available loglevel of the Python logging framework. "rec": True,
* **shutdown_timeout** "auto_add": True,
Timeout to wait for pending tasks to complete when shutdown. "event_map": {}
}
```

BIN
docs/.config.py.swp Normal file

Binary file not shown.

View File

@@ -67,11 +67,11 @@ class Task:
class TaskScheduler: class TaskScheduler:
def __init__(self, job, delay=0, files=True, directories=False, def __init__(self, job, delay=0, files=True, dirs=False,
logname="TaskScheduler"): logname="TaskScheduler"):
self._delay = delay self._delay = delay
self._files = files self._files = files
self._directories = directories self._dirs = dirs
self._job = job self._job = job
self._tasks = {} self._tasks = {}
self._log = logging.getLogger(logname) self._log = logging.getLogger(logname)
@@ -86,7 +86,7 @@ class TaskScheduler:
path = event.pathname path = event.pathname
maskname = event.maskname.split("|", 1)[0] maskname = event.maskname.split("|", 1)[0]
if (not event.dir and not self._files) or \ if (not event.dir and not self._files) or \
(event.dir and not self._directories): (event.dir and not self._dirs):
return return
if path in self._tasks: if path in self._tasks: