https://github.com/tomenz/fsnotify
Notify on directory or file actions
https://github.com/tomenz/fsnotify
cpp filesystemwatcher linux
Last synced: 4 months ago
JSON representation
Notify on directory or file actions
- Host: GitHub
- URL: https://github.com/tomenz/fsnotify
- Owner: Tomenz
- License: mit
- Created: 2024-08-26T13:24:57.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-10-28T07:39:38.000Z (over 1 year ago)
- Last Synced: 2024-12-16T01:12:04.040Z (over 1 year ago)
- Topics: cpp, filesystemwatcher, linux
- Language: C++
- Homepage:
- Size: 43.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/Tomenz/FsNotify/actions/workflows/cmake-single-platform.yml)
[](https://github.com/Tomenz/FsNotify/actions/workflows/codeql.yml)
[](https://github.com/Tomenz/FsNotify/actions/workflows/codacy.yml)
# FsNotify
A linux systemd service to monitors directory's or files, an executes a user defined actions if a event is detected.
# Configuration
The configuration is is done in the fsnotify.cfg file.
```
[/home/user/Downloads]
itemflag=ONLYDIR
monitortyp=CREATE
filter=core.*
limit = 2 / 10s
actiontyp=system
actionpara=ls -l /home/user/Downloads > ./ls.out
monitortyp=DELETE
filter=core.*
actiontyp=system
actionpara=echo Deleted {NOTIFYITEM}/{NAME} >> ./ls2.out
[/home/user/test.sh]
monitortyp=OPEN
filter=.*
actiontyp=system
actionpara=echo OPEN {NOTIFYITEM} >> ./ls2.out
```
monitortyp = ACCESS | ATTRIB | CLOSE_WRITE | CLOSE_NOWRITE | CREATE |
DELETE | DELETE_SELF | MODIFY | MOVE_SELF | MOVED_FROM |
MOVED_TO | OPEN | CLOSE
filter = Regular Expression to filter file or directory name
actiontyp = system | syslog | addmonitor
actionpara = if actiontyp is "system" it can be any shell command or a shell
script (*.sh)
if actiontyp is "addmonitor" the actionpara is a string with a
other monitor configuration.
Example: actionpara = "itemflag=ONLYDIR\nmonitortyp=CLOSE_WRITE\nfilter=^[^\x23]+$\nactiontyp=system\nactionpara=../calcsha.sh {NOTIFYITEM}/{NAME}"