Tool of the day: inotify

Watch config and path changes with inotifywait.

inotify reports filesystem events. inotifywait turns that into ops one-liners.

Watch configs

inotifywait -m -e close_write,move,create,delete /etc/mysql/

Useful when you need to know what changed under /etc/mysql during an incident.

Reload on change (validate first)

while inotifywait -e close_write /etc/mysql/conf.d/app.cnf; do
  mysqld --validate-config && systemctl reload mysql
done

Blind reload turns typos into outages.

vs tail

For append-only logs, tail -F wins. inotify wins for renames, replacements, and directory membership — rotations, drop-ins, cert swaps.