Hi,
this sounds like a job for incron. Basically incron can be configured to take certain actions based on filesystem events.
Assuming that you already have your printers configured in cups, and lets say they are called "printera" and printerb", you could write a script, let's call it "autoprint", like:
Code:
#!/bin/sh
fname="$1"
# Assuming that you only want to print pdf files, check it is a pdf
# otherwise do nothing
if [ $(file -b --mime-type "$fname") != "application/pdf" ] ; then
exit 0
fi
lpr -P printera "$fname"
lpr -P printerb "$fname"
Now put that script somewhere, eg /usr/local/bin/multiprint and make it executable.
Code:
chmod +x /usr/local/bin/multiprint
Next install incron:
Code:
sudo apt-get install incron
Next add an incrontab entry (here I assume the location the files will appear in is "/home/foo/DropBox/printme"). To do this open up
a text editor an make a little oneline file like the following.
Code:
/home/foo/DropBox/printme IN_CLOSE_WRITE /usr/local/bin/autoprint $@/$#
Save it in /etc/incron.d with a descriptive name, eg
/etc/incron.d/autoprint
Now (after restarting incron) any files appearing in /home/foo/DropBox/printme will be processed by the /usr/local/bin/autoprint script.
There is a fair bit of stuff covered here, and some of the finer details have been skipped but hopfully this is enough to get you started.
Evo2.