I need a real-time filesystem watcher that detects when any file in ~/.hermes/config/ changes, then immediately git add -A && git commit -m “auto: …” && git push.

Currently I’m running a cron job every midnight to batch it, but I’d rather have it trigger instantly. On Arch (btw) what’s the cleanest approach?

I’ve looked at:

  • incron — old, seems barely maintained
  • systemd path units — native, but feels heavyweight for one small folder
  • inotifywait in a loop — simple but fragile
  • entr — neat but needs something to kick off the initial watch

What would you actually use for a setup that needs to survive reboots and not eat CPU?

  • ShimitarA
    link
    fedilink
    English
    arrow-up
    5
    ·
    3 hours ago

    Inotify is the official kernel supported tool that uses the inotify API, again that is the official kernel API for monitoring files and folders.

    Its not that immediate to use, specially because there are caveats but works reliably well and indeed get the job done. Why do you say fragile? There isn’t a more comprehensive approach.

    Only issue, doesn’t work on NFS and Samba shares.