Skip to content

Instantly share code, notes, and snippets.

@lwzm
Last active December 30, 2015 00:19
Show Gist options
  • Save lwzm/7749014 to your computer and use it in GitHub Desktop.
Save lwzm/7749014 to your computer and use it in GitHub Desktop.
auto run something whith inotiry
#!/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
while find . -name "*.as" | inotifywait --fromfile - >dev/null 2>&1; do
date;
sleep 0.1;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment