directory:monitor_a_directory_for_changes:using_incron
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
directory:monitor_a_directory_for_changes:using_incron [2021/01/26 11:22] – peter | directory:monitor_a_directory_for_changes:using_incron [2022/06/13 09:17] (current) – removed peter | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Directory - Monitor a directory for changes - Using incron ====== | ||
- | |||
- | **incron** is like cron but instead of time-based events, the events are based on file notifications. | ||
- | |||
- | ---- | ||
- | |||
- | ===== Install incron ===== | ||
- | |||
- | <code bash> | ||
- | sudo apt install incron | ||
- | </ | ||
- | |||
- | |||
- | <WRAP info> | ||
- | **NOTE: | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Monitor ===== | ||
- | |||
- | Edit the incron table: | ||
- | |||
- | <code bash> | ||
- | incrontab -e | ||
- | </ | ||
- | |||
- | and populate with: | ||
- | |||
- | < | ||
- | / | ||
- | </ | ||
- | |||
- | <WRAP info> | ||
- | **NOTE: | ||
- | |||
- | * The format is **path mask command**. | ||
- | |||
- | This monitors the directory for changes and runs the program passing along some parameters: | ||
- | |||
- | * **$@/ | ||
- | |||
- | Other parameters can also be included, such as: | ||
- | |||
- | * Event time as text ($%) or a number ($&). | ||
- | |||
- | Events to monitor include: | ||
- | |||
- | * **IN_ACCESS**: | ||
- | * **IN_ATTRIB**: | ||
- | * **IN_CLOSE_WRITE**: | ||
- | * **IN_CLOSE_NOWRITE**: | ||
- | * **IN_CREATE**: | ||
- | * **IN_DELETE**: | ||
- | * **IN_DELETE_SELF**: | ||
- | * **IN_MODIFY**: | ||
- | * **IN_MOVE_SELF**: | ||
- | * **IN_MOVED_FROM**: | ||
- | * **IN_MOVED_TO**: | ||
- | * **IN_OPEN**: | ||
- | |||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== List the incron table ===== | ||
- | |||
- | <code bash> | ||
- | incrontab -l | ||
- | </ | ||
directory/monitor_a_directory_for_changes/using_incron.1611660162.txt.gz · Last modified: 2021/01/26 11:22 by peter