I have the following bash script, run at system startup to view files dropped into the /srv/mutt directory. It works perfectly for a while but then simply stops 'seeing' files arriving in /srv/mutt.
I added the echo statements to try and diagnose what's wrong. This shows that the inotifywait sees the files and they're reported in /tmp/waitAndView.log but the viewing program doesn't get called.
What's going wrong? Does anyone have any ideas on the cause or on how to diagnose the problem? It seems''
#!/bin/bash
#
#
# script to detect new files in /srv/mutt and display them, run from 'Session & Startup'
#
cd /srv/mutt # where the files appear
shopt -s nocasematch # ignore case in case (erk!)
#
#
# inotifywait will output the name of any file that is rsynced into /srv/mutt
#
inotifywait -m -q -e moved_to --format %f /srv/mutt/ | \
#
#
# Handle file as appropriate
#
while read -r file; do
echo $file >>/tmp/waitAndView.log
case $file in
dbapost*)
#
#
# run dbapost on the received message file
#
/home/chris/.cfg/bin/dbapost $file &
;;
*.pdf)
#
#
# View PDF file with atril
#
atril $file &
;;
*.jpg|*.png|*.jpeg)
#
#
# View other image formats with nomacs
#
nomacs $file &
;;
*.html)
#
#
# HTML file is an E-Mail to view with web browser
#
$HOME/bin/browser --new-tab file:///srv/mutt/$file &
;;
*)
;;
esac
echo finished with $file >>/tmp/waitAndView.log
done
atrilandnomacsetc. On my system that would be/usr/bin/atril...