Ok, é uma solução desagradável, mas, no meu caso, deve funcionar em ~ 90% dos casos.
temPrint=/dev/shm/print
fcheck_1=$temPrint/fcheck_1
fcheck_new=$temPrint/fcheck_new
fcheck_old=$temPrint/fcheck_old
fcheck_preprint=$temPrint/fcheck_preprint
fcheck_print=$temPrint/fcheck_print
printDir="/media/smb_share/temp/monitor"
test -d $temPrint || mkdir $temPrint
while [ true ]; do
test -e $fcheck_new && rm $fcheck_new
test -e $fcheck_old || touch $fcheck_old
test -e $fcheck_print && rm $fcheck_print
ls -l "$printDir"/*.pdf > $fcheck_1
while read line
do
echo "${line#*"/"}" | sed "s#^#/#" >> $fcheck_new
done < $fcheck_1
rt=$(diff $fcheck_new $fcheck_old | grep "<")
if [ "$rt" ]; then
echo "$rt" > $fcheck_preprint
while read line
do
echo "${line#*"/"}" | sed "s#^#/#" >> $fcheck_print
done < $fcheck_preprint
while read line
do
echo "$line"
done < $fcheck_print
cp $fcheck_new $fcheck_old
fi
sleep 20
done