minnotify
Software
www.skarnet.org
minnotifyd reads a stream, sent by minnotify, on stdin. It extracts the data, and executes a program of your choice with certain environment variables.
minnotifyd prog args...
Before running prog, minnotifyd sets the following environment variables, corresponding to the arguments that the client has given to its minnotify call:
prog should exit 0 to report success and non-zero to report
failure.
The minnotify connection stays open while prog
is running, because minnotifyd is waiting for prog's
exit code. If you want to assume that it will succeed and close the
connection early, make prog fork, have the parent exit 0,
and the child do the work.
minnotifyd does not listen to the network itself. If you want to use it to wait for notification messages over the network, run it under a super-server like inetd, xinetd, or (better) a UCSPI server such as tcpserver. For instance, the command line
tcpserver -x rules.cdb 0 5432 minnotifyd doit
listens on all addresses for connections on port 5432, and runs doit with the environment adjusted when it receives a connection - if it is accepted according to the rules defined in the rules.cdb file.
For daemontools users, an example service directory for minnotifyd is provided in the service subdirectory of the minnotify distribution.
CAUTION: you should use the TCP access control facility of your
super-server to restrict access to the IPs of the allowed notifiers.
Failure to do so would allow anyone to send possibly bogus notifications to you.