Jobnames displayed by lpq: Fixed a bit

Joel Hammer Joel at HammersHome.com
Sat Dec 1 23:12:02 GMT 2001


There has been some correspondence about getting the file names displayed
with lpq instead of the smbXXXXX name. The -J option works, but, with some
documents, notably Microsoft Word and Corel WP9, the application sends a
long preamble, such that the file name is never seen in the queue when
listed with lpq.
eg:
Microsoft Word - PRINT FILE NAME.doc
So, to fix this up, at least for word documents, the following print command
seems to work:

 print command = echo %J %p %s >>  /tmp/junkJ;\
                       a="`echo '%J' | sed "s/^.*- //"`" ;\
                       echo This is truncated $a >> /tmp/junkJ;\
                       /usr/bin/lpr -Pps  -J"$a"  %s;\
                       rm %s
I left in the debugging commands, since you never know when it will break
again.
Of course, the sed command could be much improved, say, to take only the 20
right characters or made into a decent script which would remove all sorts of
preambles, not just those ending with " - "; but, you get the idea.
BTW, after much aggravation, I have come to think that kill -SIGHUP samba_pid
does not force an immediate re-read of smb.conf. It takes a few minutes, I
THINK.
So, better to stop/restart smbd when fooling around with smb.conf, if nobody
is logged onto it.
Joel





More information about the samba mailing list