Central Queensland Linux User Group

  • home
  • faq's
  • hints, help and information
  • links
  • linux programming
  • media
  • events
  • about us
Home

Inotify: Build a monitoring script

noorbeast — Sat, 2010-06-26 21:35

The inotify tools are great for monitoring files and scripting some subsequent actions. To install on Ubuntu do the following: sudo apt-get install inotify-tools

I use inotifywait to monitor the CQLUG IRC via the command line chat program centerim, and link it to sound and system notifications as follows:

#!/bin/sh

while inotifywait -e modify ~/.centerim/i#cqlug/history; do

MSG=`tail -n 1 -q ~/.centerim/i#cqlug/history`
notify-send -i ~/tarazan-virusp.png -u normal -t 20000 "CQLUG" "$MSG"; play /home/user/.centerim/Sounds/Question.wav;done

done

However, there are many other possible uses. For example it could be used as a trigger for an automated backup of a critical file, whenever that file is changed, or to monitor proc information, or even monitoring log files. It is only limited by your imagination and needs.

  • How-To's

Navigation

  • Recent posts

User login

  • Request new password

Events

Coming to a meeting soon!
Meetings for 2020
more

Who's online

There are currently 0 users and 0 guests online.
  • home
  • faq's
  • hints, help and information
  • links
  • linux programming
  • media
  • events
  • about us