executes commands upon file system events (using inotify)
Go to file
Albert S. 92887b4d8d Added TODO 2014-12-20 20:12:01 +01:00
Makefile replace gcc with in makefile 2014-03-05 18:18:56 +01:00
README Implemented -e: exit adhocify if child exits with specified return code 2014-12-20 20:11:51 +01:00
TODO Added TODO 2014-12-20 20:12:01 +01:00
adhocify.c Implemented -e: exit adhocify if child exits with specified return code 2014-12-20 20:11:51 +01:00

README

What is adhocify?
=================
adhocify uses inotify to watch for file system events. 
Once an event occurs a script will be launched.
It can pass the path of the file the event occured on to this script. 

Requirements
============
adhocify only runs on Linux. You need a kernel and libc with inotify support.

How do I use adhocify?
======================
Launch adhocify without any arguments and you will get the options listed.

Examples:
./adhocify -w /tmp/ /home/core/myscript.sh
------------------------------------------
Watches for IN_CLOSE_WRITE events in /tmp/, launches script /home/core/myscript.sh

/adhocify -w /tmp/ /home/core/myscript.sh {}
------------------------------------------
Same as above, but also passes the file an event occured on to that script. (argv[1]).


./adhocify -w /tmp/ /bin/echo the file {} was written to
---------------------------------------------------------
Running
echo "Test" > /tmp/test

Will print in the shell adhocify was launched in:
the file /tmp/test was written to

./adhocify -w /tmp/ -w /var/run /home/core/myscript.sh
------------------------------------------------------
Same as above, but also watches /var/run

./adhocify /home/core/myscript.sh
---------------------------------
Watches for IN_CLOSE_WRITE events in the current directory, launches script 
/home/core/myscript.

./adhocify -m IN_OPEN -w /tmp /home/core/myscript.sh
----------------------------------------------------
Watches for IN_OPEN events in /tmp/, launches script /home/core/myscript.sh

./adhocify -w /tmp -i *.txt /home/core/myscript.sh
--------------------------------------------------
... ignores *.txt files ....


Further options
===============
-e, --exit-with-child: Instructs adhocify to exit once a child does. You can also specify an exit code, e. g. -e 1, to exit on errors. Default is 0.