I have been running inotify-wait on my ftp server in byobu to monitor a folder, move data, and send email notifications for a few months without problems. Since I started this I have added 3 more folders that I monitor and I would like to start running inotify-wait as a daemon instead of in byobu sessions. I modified my script to be easier to only require a single variable to be changed and to run as a daemon. Unfortunately it now does nothing. I was hoping someone with some experience could take a look and tell me where Ive gone wrong.
#!/usr/bin/env bash
user=testuser
dir=/ftp/"$user"/upload/
log=/ftp/"$user"/log/"$user.log"
archive=/ftp/"$user"/archive/
target=/ftp/FTPDATA/"$user"/
inotifywait -q\
-d "$dir" \
-o "$log" \
-e close_write --format %f . | while IFS= read -r file; do
cp -p "$file" "$target"
/scripts/"$user-notify.sh"
mv "$file" "$archive""$(date +%F-%T)"
done
Asked by rfinterference
(11 rep)
Jul 21, 2015, 03:14 PM
Last activity: Jun 15, 2025, 02:03 PM
Last activity: Jun 15, 2025, 02:03 PM