aboutsummaryrefslogtreecommitdiff
path: root/watchdir
diff options
context:
space:
mode:
Diffstat (limited to 'watchdir')
-rwxr-xr-xwatchdir55
1 files changed, 27 insertions, 28 deletions
diff --git a/watchdir b/watchdir
index fe215b2..701ed33 100755
--- a/watchdir
+++ b/watchdir
@@ -2,51 +2,50 @@
usage()
{
- echo "$0 [-s <size>] [-r] [-h] [-d <subdir>] <dir>"
+ echo "$0 [-s <size>] [-r] [-h] [-j <jobs>] <dir>"
}
REGEN=0
SIZE=96
-while getopts rs:d:h arg
+while getopts rj:s:h arg
do
- case $arg in
- r) REGEN=1
- ;;
- s) SIZE="$OPTARG"
- ;;
- h) usage
- exit 0
- ;;
- d) SUBDIR="$OPTARG"
- ;;
- ?) usage >&2
- exit 1
- ;;
- esac
+ case $arg in
+ j) JOBS="$OPTARG"
+ ;;
+ r) REGEN=1
+ ;;
+ s) SIZE="$OPTARG"
+ ;;
+ h) usage
+ exit 0
+ ;;
+ ?) usage >&2
+ exit 1
+ ;;
+ esac
done
shift $(($OPTIND - 1))
if [ $# != 1 ]; then
- usage >&2
- exit 1
+ usage >&2
+ exit 1
fi
DIR="$1"
[ "$REGEN" -eq 1 ] && "$(dirname $0)/tngen" \
- ${SIZE:+-s$SIZE} \
- -d "$DIR" \
- "$DIR/user"
+ ${SIZE:+-s$SIZE} \
+ ${JOBS:+-j$JOBS} \
+ "$DIR"
while :
do
- F="$(inotifywait -e modify,move,create,delete \
- --format "%w%f" -qr "$DIR/user/")"
- sleep 1 # TODO: revisit this
- "$(dirname $0)/tngen" \
- ${SIZE:+-s$SIZE} \
- -d "$DIR" \
- "$F"
+ F="$(inotifywait -e modify,move,create,delete \
+ --format "%w%f" -qr "$DIR/user/")"
+ "$(dirname $0)/tngen" \
+ ${SIZE:+-s$SIZE} \
+ ${JOBS:+-j$JOBS} \
+ "$DIR"
done