inotifywait - Why does this simple email script sends two emails every time -


why script send 2 emails instead of one?

#!/bin/sh monitordir="/path/to/directory" inotifywait -m -r -e create --format '%w%f' "${monitordir}" | while read  newfile [  -z "${newfile}" ] && : || movie=$(find "$newfile" -type f -not -name ".*"  \( -iname "*.mkv" -o -iname "*.mp4" -o -iname "*.avi" \) -exec basename {}  \; | sed 's/\.[^.]*$//') [  -z "${movie}" ] && : || echo "please don't reply  automatically generated email message." | mail -s "$movie on plex!"  "email1@gmail.com,email2@gmail.com" done 


Comments

Popular posts from this blog

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -

python - Error while using APScheduler: 'NoneType' object has no attribute 'now' -