Posted on 12 July, 2023 🏷  linux, reference

incron is an “inotify cron” system. It consists of a daemon and a table manipulator. You can use it a similar way as the regular cron. The difference is that the inotify cron handles filesystem events rather than time periods.

I use it to auto-commit changes made to specific files to version control.

Example usage

View incrontabs:

incrontab -l

Add/edit incrontabs:

incrontab -e
# commit and push when file is modified and saved
/home/wangonya/dir_to_track	IN_MODIFY	cd /home/wangonya/dir_to_track; git commit -a -m 'autocommit on change'; git push

Archwiki for more info.