Initially, I tried to run inotifywait
in monitor mode, like this:
for i in $(seq 1 3)
do
echo "stage $i"
train_model &
pid=$!
inotifywait -mq -e close_write --format '%f' $MODEL_SAVE_PATH | while read FILE
do
echo "[`date "+%F %T"`] new model: $FILE"