Table of Contents


Start ./ -h to get the help


  T R I G G E R    C O M M A N D    O N    A    F I L E C H A N G E

INFO: stat command detected
        This script checks the change of a given file and triggers
        a command if it changes

        -c [command]
            command to execute on a file change
        -f [filename(s)]
            filenames to watch; separate multiple files with space and put all in quotes
            show this help
            force inotifywait command
                force stat command (default mode)
            verbose mode; enable showing debug output
        -w [integer]
            for stat mode: wait time in seconds betweeen each test or on missing file; default: 5 sec

EXAMPLES: -f /home/me/touchfile.txt -c "ls -l" 
            watch touchfile.txt and make a file listing on change -f "/home/me/touchfile.txt home/me/touchfile2.txt" -c "ls -l" 
            watch touchfile.txt and touchfile2.txt -f /home/me/touchfile.txt -s -w 10 -c "echo hello" 
            watch touchfile.txt every 10 sec with stat and show "hello" on a change

Test on command line

To make a test on commandline touch a testfile touch /tmp/mytestfile. The start the script with enabled debugging (-d) in a 2nd terminal:

/usr/local/bin/ -v -f "/tmp/mytestfile" -c 'echo "hello"'

Each time you touch the testfile in another terminal window it should show “hello”.