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
Hi,> 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.[...] OK - accepted as workaround, but not really a nice solution. I just wondered whether the long jobname gets truncated by lpq or anywhere else. Look: odenbach@robin[~]>>echo bla | lpr -J '12345678901234567890123456789012345678901234567890' odenbach@robin[~]>>lpq Printer: lw_sw_rbg_1_F0_113@pooh (dest lw_sw_rbg_1_F0_113@pooh) 'HP LaserJet 5MP in F0.113' (printin) Queue: 1 printable job Server: no server active Status: server finished at 11:49:56 Rank Owner/ID Class Job Files Size Time 1 odenbach@robin+120 A 120 12345678901234567890123 4 12:18:16 But: root@pooh[lpd]# grep '^J' lw_sw_rbg_1_F0_113/cfA120robin J12345678901234567890123456789012345678901234567890 Hey, so the lpd really has the long name! Leaves the question: Is it the lpd that truncates the jobname, or is it lpq? Which one should be patched? :-) This just gives me another idea: If the samba server has somehow access to the filesystem containing the spool directory of the lpd (e.g. they are both on one machine which makes sense very often), then one could quickly hack a script that grabs the 'J'-line from the control file of the spool dir. This would lead to an lpq-wrapper. If I have time, I'll give it a try. So long, Christopher