How turn a folder into a print queue?
Solution 1:
There is a simpler solution in 4 steps and a small shell script:
-
make your own spool directory:
/usr/bin/sudo mkdir /var/spool/my_printer
-
write the following shell script within your usual local bin directory let's say
/local/bin
cd /local/bin
copy the following inside
my_spooler
:#!/bin/sh # go into the spool directory cd /var/spool/my_printer # main loop: loop till end of time while : ; do # check for any newly arrived text file for _file in * ; do # if _file is a normal file, print and remove it (-r option to lpr) [ -f "${_file}" ] && lpr -r "${_file}" done # don't loop like a fool sleep 300 done
-
make your
my_spooler
executable:chmod u+x my_spooler
-
start it:
my_spooler &
it should start without a full path if
/local/bin
is within yourPATH
if it isn't, then start it this way:/local/bin/my_spooler &
The ending
&
means start it in background so as not to block your session waiting until the end of time.
How to use it
To use it you simply have to move any text or PS or PDF file within your own defined spool directory how you prefer. Either with the Finder
or with basic command line:
cp my_file.pdf /var/spool/my_printer