#!/bin/bashThis then runs in from cron, every 10 minutes. If it finds a PDF file in the PRINTBOX directory, it, er, prints it!
#printbox
#monitor /home/user/Dropbox/PRINTBOX for new pdf files and print them to the printer then move them to /home/user/printed/
#
PATH=$PATH:/usr/bin:/bin
MONITORDIR=/home/user/Dropbox/PRINTBOX
PRINTEDDIR=/home/user/printed
PRINTER=Black-and-White-Printer
#
ls -1 $MONITORDIR/*.pdf > /dev/null 2>&1
STATUS=$?
if [[ $STATUS -eq 0 ]]
then
ls -1 $MONITORDIR/*.pdf|while read FILE
do
echo $FILE
echo "lpr -P $PRINTER \"$FILE\""
lpr -P $PRINTER "$FILE"
echo "mv \"$FILE\" $PRINTEDDIR/. "
mv "$FILE" $PRINTEDDIR/.
echo "\"$FILE\" printed on $PRINTER."
done
else
echo "NO FILES"
fi
So basically if I upload a PDF file into that folder using my iPhone and dropbox, it's ready and waiting on the printer when I get home. Same from my work PC, where I can also run Dropbox. It even works via the dropbox.com web interface.