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 bashuser=testuserdir=/ftp/$user/upload/log=/ftp/$user/log/$user.logarchive=/ftp/$user/archive/target=/ftp/FTPDATA/$user/inotifywait -q\-d $dir \-o $log \-e close_write --format %f . | while IFS= read -r file; docp -p $file $target/scripts/$user-notify.shmv $file $archive$(date +%F-%T)doneI am guessing the problem is with the -d $dir but this is only my second time working with inotify-wait. Any help would be very much appreciated.
Problem with inotify-wait as daemon
bash;scripting;inotify