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:32] – 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 | ||
- | </ | ||
- | |||
- | |||
- | ---- | ||
- | |||
- | ===== Change Permissions ===== | ||
- | |||
- | Add users to the **/ | ||
- | |||
- | <file bash / | ||
- | peter | ||
- | </ | ||
- | |||
- | <WRAP info> | ||
- | **NOTE: | ||
- | |||
- | **/ | ||
- | </ | ||
- | |||
- | ---- | ||
- | |||
- | ===== Monitor ===== | ||
- | |||
- | Edit the incron table: | ||
- | |||
- | <code bash> | ||
- | incrontab -e | ||
- | </ | ||
- | |||
- | and populate with: | ||
- | |||
- | < | ||
- | / | ||
- | |||
- | / | ||
- | </ | ||
- | |||
- | <WRAP info> | ||
- | **NOTE: | ||
- | |||
- | The format is very picky; use spaces, not tabs! | ||
- | |||
- | * The format is **path mask command**. | ||
- | |||
- | Parameters can include: | ||
- | |||
- | * **$$**: | ||
- | * **$@**: | ||
- | * **$# | ||
- | * **$%**: | ||
- | * **$& | ||
- | |||
- | |||
- | 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.1611660774.txt.gz · Last modified: 2021/01/26 11:32 by peter