lwzm
12/2/2013 - 12:51 PM

auto run something whith inotiry

auto run something whith inotiry

while find . -name "*.as" | inotifywait --fromfile - >dev/null 2>&1; do
    date;
    sleep 0.1;
done
#!/bin/sh
DUMP_FILE="dump"
while inotifywait -e modify,attrib $DUMP_FILE; do
    while lsof $DUMP_FILE; do
        echo "waiting..." && sleep 1
    done
    cp $DUMP_FILE $DUMP_FILE.$(date "+%Y-%m-%d--%T")
done