extend README.md

This commit is contained in:
2020-11-02 15:53:09 +01:00
parent c4a0b44ef5
commit 384d29025e
2 changed files with 24 additions and 5 deletions

View File

@@ -2,7 +2,7 @@
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.
## Dependencies ## Dependencies
[pyinotify](https://github.com/seb-m/pyinotify) * [pyinotify](https://github.com/seb-m/pyinotify)
## Installation ## Installation
* Install pyinotifyd with pip. * Install pyinotifyd with pip.
@@ -10,3 +10,22 @@ A daemon to monitore filesystems events with inotify on Linux and execute tasks,
pip install pyinotifyd pip install pyinotifyd
``` ```
* Modify /etc/pyinotifyd/config.py according to your needs. * Modify /etc/pyinotifyd/config.py according to your needs.
## Global configuration
The config file is written in Python syntax. pyinotifyd reads config options from a dictionary named **pyinotifyd_config**.
This is the default configuration:
```python
pyinotifyd_config = {
"watches": [],
"loglevel": logging.INFO,
"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.

View File

@@ -285,15 +285,15 @@ def main():
print(f"pyinotifyd ({__version__})") print(f"pyinotifyd ({__version__})")
sys.exit(0) sys.exit(0)
default_config = { cfg = {
"watches": [], "watches": [],
"loglevel": logging.INFO, "loglevel": logging.INFO,
"shutdown_timeout": 30} "shutdown_timeout": 30}
cfg = {"pyinotifyd_config": default_config} cfg_vars = {"pyinotifyd_config": cfg}
with open(args.config, "r") as c: with open(args.config, "r") as c:
exec(c.read(), globals(), cfg) exec(c.read(), globals(), cfg_vars)
cfg = cfg["pyinotifyd_config"] cfg.update(cfg_vars["pyinotifyd_config"])
console = logging.StreamHandler() console = logging.StreamHandler()
formatter = logging.Formatter( formatter = logging.Formatter(