Fixed inotify mechanism.

This commit is contained in:
Louwrentius 2010-07-18 09:37:19 +00:00
parent 20e8cdce95
commit 1575fb28f6
1 changed files with 21 additions and 12 deletions

13
ppss
View File

@ -1562,6 +1562,10 @@ upload_item () {
lock_item () { lock_item () {
if [ "$INOTIFY" = "1" ] && [ "$DAEMON" = "1" ]
then
return 0
else
ITEM="$1" ITEM="$1"
LOCK_FILE_NAME_MD5=`echo "$ITEM" | $MD5 | awk '{ print $1 }'` LOCK_FILE_NAME_MD5=`echo "$ITEM" | $MD5 | awk '{ print $1 }'`
ITEM_LOCK_FILE="$ITEM_LOCK_DIR/$LOCK_FILE_NAME_MD5" ITEM_LOCK_FILE="$ITEM_LOCK_DIR/$LOCK_FILE_NAME_MD5"
@ -1569,6 +1573,7 @@ lock_item () {
exec_cmd "mkdir $ITEM_LOCK_FILE >> /dev/null 2>&1" exec_cmd "mkdir $ITEM_LOCK_FILE >> /dev/null 2>&1"
ERROR="$?" ERROR="$?"
return "$ERROR" return "$ERROR"
fi
} }
get_input_lock () { get_input_lock () {
@ -2173,6 +2178,8 @@ run_command () {
INPUT="$REGISTER" INPUT="$REGISTER"
fi fi
log DEBUG "Now processing $INPUT"
if [ ! -d "$INPUT" ] && [ ! -z "$INPUT" ] if [ ! -d "$INPUT" ] && [ ! -z "$INPUT" ]
then then
commando "$INPUT" & commando "$INPUT" &
@ -2272,7 +2279,10 @@ inotify_listener () {
inotifywait "$SRC_DIR" -m -e close -q --format '%w%f' | \ inotifywait "$SRC_DIR" -m -e close -q --format '%w%f' | \
while read -r line while read -r line
do do
if [ ! -d "$line" ]
then
echo "$line" > "$FIFO" echo "$line" > "$FIFO"
fi
done done
} }
@ -2300,7 +2310,6 @@ is_item_unprocessed () {
return $STATUS return $STATUS
} }
is_item_file_and_unmodified () { is_item_file_and_unmodified () {
ITEM="$1" ITEM="$1"
@ -2442,7 +2451,7 @@ listen_for_job () {
infanticide infanticide
break break
else else
log DEBUG "Event is an item!" log DEBUG "Event $event is an item!"
stack_push "$event" stack_push "$event"
run_command run_command
fi fi