|
watch
|
watch - watch for events
Watch provides a command-line interface to the kqueue facility in BSD.
Currently it allows files and processes to be watched. It has the same
limitations as kqueue, however, and can only safely watch files on local
UFS filesystems.
FEATURES
- Can specify events interested in.
- Can exit on occurence of event, or can continously watch, printing
out messages for each event.
- Can monitor for file creation, and across deletion and creation.
- Freeware.
DEFICIENCIES
- Watch uses strtonum() which at the moment is OpenBSD specific.
- Be nice to do more than just files and processes.
- Does not track children.
DOWNLOAD
watch is available as:
SOME EXAMPLES
To watch a file for any change:
watch -f /etc/master.passwd
To watch a file for a write:
watch -f /var/log/sulog -e write
To continously watch a process for forking:
watch -ct -p `cat /var/run/sshd.pid` -e fork
To watch a daemon for exit, and log exit to syslog:
watch -d -S daemon.err -p `cat /var/run/sshd.pid` -e exit
To take action when a process exits:
watch -q -p `cat /var/run/inetd.pid` -e exit && /usr/sbin/inetd