Quick Linux Tip #18:
Try: sudo inotifywait -m -e modify /etc/nginx/nginx.conf
Info: inotifywait monitors filesystem events using the Linux inotify kernel API. The -m option keeps it running in monitor mode.
Examples:
- $ inotifywait -m -e modify /etc/nginx/nginx.conf | while read; do systemctl reload nginx; done
- $ inotifywait -m -r -e create /var/incoming | while read path event file; do process "$file"; done
- $ inotifywait -m -e close_write src/ | while read; do npm run build; done
Note: Install with sudo apt install inotify-tools. Common events include modify, create, delete, and close_write. Use -r for recursive directory watching.
Leave a Reply