1 | #! /bin/sh |
---|
2 | # |
---|
3 | # PyKota - Print Quotas for CUPS and LPRng |
---|
4 | # |
---|
5 | # (c) 2003-2004 Jerome Alet <alet@librelogiciel.com> |
---|
6 | # You're welcome to redistribute this software under the |
---|
7 | # terms of the GNU General Public Licence version 2.0 |
---|
8 | # or, at your option, any higher version. |
---|
9 | # |
---|
10 | # You can read the complete GNU GPL in the file COPYING |
---|
11 | # which should come along with this software, or visit |
---|
12 | # the Free Software Foundation's WEB site http://www.fsf.org |
---|
13 | # |
---|
14 | # $Id$ |
---|
15 | # |
---|
16 | # Fix by Matt Hyclak & Jerome Alet |
---|
17 | |
---|
18 | # If ending phase, after the job has been fully transmitted to the printer |
---|
19 | # we have to wait for the printer being in printing mode before checking |
---|
20 | # if it is idle, otherwise we could have problems with slow printers. |
---|
21 | # When using the pykota filter, PYKOTAPHASE is not defined at the |
---|
22 | # first requesting stage (which is the ending phase of the previous |
---|
23 | # job), because waiting for the printer being printing wouldn't be OK : |
---|
24 | # the printer would effectively never print again if the previous job |
---|
25 | # was already fully printed. |
---|
26 | if [ x$PYKOTAPHASE == "xAFTER" ]; then |
---|
27 | until snmpget -v1 -c public -Ov $1 HOST-RESOURCES-MIB::hrPrinterStatus.1 | grep -i printing >/dev/null; do |
---|
28 | sleep 1 ; |
---|
29 | done |
---|
30 | fi |
---|
31 | |
---|
32 | # In any case, wait until the printer is idle again. |
---|
33 | until snmpget -v1 -c public -Ov $1 HOST-RESOURCES-MIB::hrPrinterStatus.1 | grep -i idle >/dev/null ; do |
---|
34 | sleep 1 ; |
---|
35 | done |
---|