Problem
Adding a large number of printers (40 or more) at the same time may generate the following warning from lpsched:
UX:lpadmin: WARNING: The LP print service can't take another printer.
The printer configuration has been saved on disk nonetheless. To fix this problem, stop the LP print service (/usr/lib/lpshut) and restart it (/usr/lib/lpsched) to have it recognize the new printer.
If the printer is being added within a looping script and enabled and accepted at the same time then these subsequent commands will fail with:
UX:enable: ERROR: Destination "lptest267" is unknown to the LP print service.
UX:accept: ERROR: Destination "lptest267" is unknown to the LP print service.
An example script to add a large number of printers:
i=0
while [ $i -lt 300 ]
o
touch /tmp/lptest$i
/usr/lib/lpadmin -p lptest$i -v /tmp/lptest$i
enable lptest$i
accept lptest$i
i=`expr $i + 1`
done Cause
The lpsched daemon has internally run out of memory used to add new
printers. The actual number of printers added before reaching this
state depends on how long the scheduler has been running and what
work it has been doing.The lpadmin command will still succeed in adding the printer configuration files but it is unknown to the scheduler until lpsched it stopped and restarted.
Therefore, further commands such as "enable" and "accept" run on the newly added printer will fail until the scheduler is restarted.
Solution
Stop and restart the print scheduler after adding the printers:
/usr/lib/lpshut
/usr/lib/lpschedas the error message indicates.If this is scripted within a loop then split the additional printer commands out into a separate loop to run after the printers have been added and after the print scheduler has been restarted, for example:
# Add the printer in the first loop
i=0
while [ $i -lt 300 ]
do
touch /tmp/lptest$i
/usr/lib/lpadmin -p lptest$i -v /tmp/lptest$i
i=`expr $i + 1`
done# Stop and restart the scheduler so that all printers are seen
/usr/lib/lpshut
/usr/lib/lpsched# enable and accept the printer in the second loop
i=0
while [ $i -lt 300 ]
do
enable lptest$i
accept lptest$i
i=`expr $i + 1`
doneNOTES: There may also be other limitations within the system which prevent
creation of a large number of printers, for example the maximum
number of subdirectories on UnixWare (one for each printer under
/etc/lp/printers). This is controlled by the MAXLINK kernel
parameter, which defaults to 1000 and can be tuned up to 32767.