Fixed inotify mechanism.
This commit is contained in:
parent
20e8cdce95
commit
1575fb28f6
13
ppss
13
ppss
@ -1562,6 +1562,10 @@ upload_item () {
|
||||
|
||||
lock_item () {
|
||||
|
||||
if [ "$INOTIFY" = "1" ] && [ "$DAEMON" = "1" ]
|
||||
then
|
||||
return 0
|
||||
else
|
||||
ITEM="$1"
|
||||
LOCK_FILE_NAME_MD5=`echo "$ITEM" | $MD5 | awk '{ print $1 }'`
|
||||
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"
|
||||
ERROR="$?"
|
||||
return "$ERROR"
|
||||
fi
|
||||
}
|
||||
|
||||
get_input_lock () {
|
||||
@ -2173,6 +2178,8 @@ run_command () {
|
||||
INPUT="$REGISTER"
|
||||
fi
|
||||
|
||||
log DEBUG "Now processing $INPUT"
|
||||
|
||||
if [ ! -d "$INPUT" ] && [ ! -z "$INPUT" ]
|
||||
then
|
||||
commando "$INPUT" &
|
||||
@ -2272,7 +2279,10 @@ inotify_listener () {
|
||||
inotifywait "$SRC_DIR" -m -e close -q --format '%w%f' | \
|
||||
while read -r line
|
||||
do
|
||||
if [ ! -d "$line" ]
|
||||
then
|
||||
echo "$line" > "$FIFO"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
@ -2300,7 +2310,6 @@ is_item_unprocessed () {
|
||||
return $STATUS
|
||||
}
|
||||
|
||||
|
||||
is_item_file_and_unmodified () {
|
||||
|
||||
ITEM="$1"
|
||||
@ -2442,7 +2451,7 @@ listen_for_job () {
|
||||
infanticide
|
||||
break
|
||||
else
|
||||
log DEBUG "Event is an item!"
|
||||
log DEBUG "Event $event is an item!"
|
||||
stack_push "$event"
|
||||
run_command
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user