Ubuntu Server Administration - Inotify Example
Monitor folder and write in file with timestamp in ubuntu server with inotify. Simply way to monitor and write in file in following code:
- Install inotify
- Start inotifywait
- Description
sudo apt-get install inotify-tools
After installing inotify write in ubuntu terminal following inotify code:
inotifywait -mr -e modify -e delete --format %T%W%f_%e --timefmt "%d/%m/%X_%H:%M" <folderpath> >> <filename_with_path>
Description: Events and options for inotify:
- inotifywait starts inotify
- -m starts inotify after event again
- -r monitor all files and folders recursive
- -e modify monitor all modifications
- -e delete monitor all delete events
- --format format output style
- --timefmt format time
- > write in new file
- >> write in same file (e.g. /root/check_folder.log)