This is how we do it.
POLL(1) Plan B â 3rd edition POLL(1)
NAME
poll - poll files for changes
SYNOPSIS
poll [ -1 ] [ -i ival ] cmd file...
DESCRIPTION
Poll monitors the given files each ival seconds (one by
default) and runs cmd when any of the files change. It uses
fstat(2) to generate a single stat(5) request for each poll
and file. If -1 is given, the program exits after the first
change noticed; otherwise, it keeps on polling the files.
The command is assumed to be at /bin and is executing using
the list of files as arguments.
SOURCE
/sys/src/cmd/poll.c
Page 1 Plan B User's Manual (printed 4/19/05)
--- Begin Message ---
I read about "watch" command in the mpx paper (*) and thought
it's interesting. The paper mentions the commandline:
watch fig1.pic | pic | troff | proof
and the pipe line runs whenever fig1.pic is modified.
Does anyone have a similar program in his pocket?
(*) hget http://cm.bell-labs.com/cm/cs/doc/83/mpx.ps.gz | gunzip | page
I'm thinking of writing a file server (watchfs) which will serve:
/n/watch/ctl
/n/watch/data/a.c
/n/watch/data/b.c
Whenever a.c and b.c are changed, a text will appear on the ctl file.
Thus, you can do something like:
% while(){read /n/watch/ctl; mk}
How's this idea?
--
--- End Message ---