[Samba] bsd printing and samba 4.17

Piviul piviul at riminilug.it
Tue Feb 6 13:25:36 UTC 2024


On 1/9/24 18:38, Michael Tokarev wrote:
> 09.01.2024 12:18, Piviul via samba:
> ...
>>
>> As you can see all seems to works except that the document printed is 
>> not automatically removed from the spool, and as I already say, 
>> remain in queue and lock further documents printing.
>>
>> On the logs I can't find nothing relevant but if you need something 
>> please let me know.
>
> In man 5 smb.conf, near 'print command', we can read:
>
>  The server will not remove the spool file, so whatever command you 
> specify should
>  remove the spool file when it has been processed, otherwise you will 
> need to
>  manually remove old spool files.

Yes, you are right, I forgot on the script to add the command to delete 
the spool but even adding the command doesn't seems to solve the 
problem, the spool remain in queue and lock further documents printing.

I've done little changes to smb.conf and the testBSD.sh script so I 
resend you;

smb.conf:

> # Global parameters
> [global]
>     log file = /var/log/samba/log.%m
>     logging = file
>     map to guest = Bad User
>     max log size = 1000
>     obey pam restrictions = Yes
>     pam password change = Yes
>     panic action = /usr/share/samba/panic-action %d
>     printcap name = /etc/printcap
>     realm = AD.CSARICERCHE.COM
>     security = ADS
>     server min protocol = NT1
>     server string = %h server
>     template shell = /bin/bash
>     usershare allow guests = Yes
>     winbind refresh tickets = Yes
>     workgroup = DOMINIOCSA
>     idmap config dominiocsa : range = 10000-24999
>     idmap config dominiocsa : backend = rid
>     idmap config * : range = 3000-9999
>     idmap config * : backend = tdb
>     printing = bsd
>
>
> [printers]
>     browseable = No
>     comment = All Printers
>     path = /var/tmp
>     printable = Yes
>
>
> [print$]
>     comment = Printer Drivers
>     path = /var/lib/samba/printers
>     write list = "@DOMINIOCSA\domain admins"
>
>
> [testBSD]
>     comment = Stampante di test per debug parametri
>     invalid users = dominiocsa\userlab
>     lpq command =
>     path = /tmp
>     printable = Yes
>     print command = /opt/scripts/bin/testBSD.sh "%s"

and this is the testBSD.sh script:

> #!/bin/bash
> user_home=~
>
> Filelog=$user_home/.$(basename "$0" .sh).log
> echo "" >> $Filelog
> echo "-----------------------------------------------" >> $Filelog
> echo $(date +"%d/%m/%Y %H:%M:%S") >> $Filelog
>
> i=0
> while [ $i -lt $# ]; do
>     i=$(($i+1))
>     echo "\$$i: $(eval "echo \$$i")" >> $Filelog
> done
>
> [ -f "$1" ] && rm -f "$1" && echo "I: spool file $1 successfully 
> removed." >> $Filelog


When I print on the .testBSD.log I can find:

> -----------------------------------------------
> 06/02/2024 14:04:11
> $1: smbprn.N7FwMM
> I: spool file smbprn.N7FwMM successfully removed.
but even if the %s file is successfully removed the spool remain in 
queue and lock further documents printing.

I found this problem in samba 4.17.12-Debian on a debian bullseye but in 
samba 4.14.10-Debian on a debian buster I don't have this problem.

...and sorry for the late reply

Piviul







More information about the samba mailing list