cancel
Showing results for 
Search instead for 
Did you mean: 

Lpadmin -q ; lpfence

 
Aladin_1
Occasional Contributor

Lpadmin -q ; lpfence

Hi

I need help, Help!,

 

A collegue of mine is looking for a solution in printer priority like in HPUX :

Option like lpadmin -q or lpfence

 

Exemple options for lpadmin on HPUX:

 

/usr/sbin/lpadmin \

           -p${NAME} -orm${IP} -orp${NAME} \

           -mrmodel -v/dev/null -g${PRIORITY} \

           -ocmrcmodel -osmrsmodel # >/dev/null 2>&1

/usr/sbin/lpfence $NAME $PRIORITY

     enable $NAME > /dev/null 2>&1

     #disable $NAME > /dev/null 2>&1

     accept $NAME > /dev/null 2>&1

 

it seems not trivial to use lpadmin/linux to deal with that features /behavior.

 

Are theres solution  in order to be able to make HPUX migration ? Are there tool box to help ?

 

 

 

 

 

2 REPLIES
Matti_Kurkela
Honored Contributor

Re: Lpadmin -q ; lpfence

You mean you're using the print job priorities? How, exactly? What is the problem the priorities are solving now?

 

I don't think it is a security/user privilege issue, since any user can specify any priority s/he wishes for his/her own print jobs, using the lp/lpalt commands. If the users have shell access, the current priorities are basically a courtesy/honor-system only.

 

If the lp command lines are embedded into application configuration and not accessed directly by the users, the priorities might actually be enforceable (e.g. only certain users are allowed to send print jobs with high priority).

 

If you only need two priority levels, you might set up two printer queues for the same physical printer. The first one would be the "high-priority" queue, which would be set up as normal. The second would be the "low-priority" queue, which would be otherwise set up the same, but configured accept print jobs but not actually send them to the printer ("accepting" but not "enabled"). Then you could, for example, set up a cron job to check the status of the print queues once per minute or so.

 

The logic of the cron job might be something like this:

1.) If the low-priority queue is empty, there is nothing to do: go directly to the end.

2.) If the high-priority queue has jobs in it, go directly to the end. (The printer is busy with high-priority jobs, so the low-priority jobs must wait.)

3.) If we get to this point, the high-priority queue is empty and the low-priority queue has at least one job. So, now it's a good time to print at least one low-priority job -> lpmove the first job of the low-priority queue to the high-priority queue, so it will go to the printer and start printing.

end) Done.

 

If you need more priority levels, you need one more "low-priority queue" for each priority level, and the script must check each low-priority queue in descending order of priority.

The exact details will vary, depending on your Linux distribution and print spooler choice. The default print spooler on many modern Linux distributions is CUPS.

 

With CUPS, you can restrict print queues by username, so specific non-root users can easily be prevented from using the high-priority queue directly, if that is your requirement.

 

If your requirement is to use the priority levels as a way to accumulate low-priority jobs and then run them all later (e.g. overnight), you don't even need a once-per-minute check script: you only need a few commands to execute at the time the held jobs are released:

1.) set the high-priority queue to reject jobs or disable it (your choice)

2.) if you set the high-priority queue to reject, wait until the jobs already in the queue are completed printing

3.) enable the low-priority queue: this will cause all the low-priority jobs to be printed

 

To return to normal, disable the low-priority queue (but don't set it to reject jobs) and restore the high-priority queue to enable & accept mode.

MK
Aladin_1
Occasional Contributor

Re: Lpadmin -q ; lpfence

Thanks for the answer.

As far as my collegue explained to me....

In fact with the -q option, the spooler is able to react with the queue default priority level ( specify at queue creation)

For the requests that have a higher priority, the spooler is doing well like for  all the others requests of the queue.

 

If the request have a lower priority than te default, then the spooler blocks the request on that queue and  manuals actions have then  to be done by administrators to either route the request to another queue with lpmove or with lpfence.

 

hope that explanation is enough.