1 | <!-- $Id$ --> |
---|
2 | |
---|
3 | <chapter> |
---|
4 | <title>Useful Shell Scripts</title> |
---|
5 | <para>Last modified on $Date$</para> |
---|
6 | |
---|
7 | <para> |
---|
8 | <application>PyKota</application> comes with a number of shell scripts which |
---|
9 | help do complex things. They can be used as-is, but you may prefer to adapt |
---|
10 | them to your own configuration. All are installed in the <filename>/usr/share/pykota</filename> |
---|
11 | directory. |
---|
12 | </para> |
---|
13 | |
---|
14 | <sect1> |
---|
15 | <title>waitprinter.sh</title> |
---|
16 | <para> |
---|
17 | This script which accepts a printer's hostname or <acronym>IP</acronym> address as its first parameter |
---|
18 | is used to wait for a printer which supports the <acronym>SNMP</acronym> protocol to be in <literal>idle</literal> state. |
---|
19 | It exits as soon as the printer is <literal>idle</literal>, else loops forever. |
---|
20 | </para> |
---|
21 | |
---|
22 | <para> |
---|
23 | When defining an external <literal>requester</literal> for a printer, it is important to wait for the printer being |
---|
24 | <literal>idle</literal> before asking it for its internal page counter, otherwise results could |
---|
25 | be inaccurate. If the printer is asked while the job is still being printed, then the page counter's |
---|
26 | value will be lower than expected with regard to the real job's size. |
---|
27 | </para> |
---|
28 | |
---|
29 | <para> |
---|
30 | <filename>waitprinter.sh</filename> can be used to be sure that <application>PyKota</application> |
---|
31 | waits until no job is being printed, and no paper sheet is travelling inside the printer. |
---|
32 | </para> |
---|
33 | |
---|
34 | <tip> |
---|
35 | <title>Tip</title> |
---|
36 | <para> |
---|
37 | See the sample configuration file <filename>conf/pykota.conf.sample</filename> for examples. |
---|
38 | </para> |
---|
39 | </tip> |
---|
40 | </sect1> |
---|
41 | |
---|
42 | <sect1> |
---|
43 | <title>papwaitprinter.sh</title> |
---|
44 | <para> |
---|
45 | This script which accepts a printer's AppleTalk name as its first parameter |
---|
46 | is used to wait for a printer which supports the <acronym>AppleTalk</acronym> protocol to be in <literal>idle</literal> state. |
---|
47 | It exits as soon as the printer is <literal>idle</literal>, else loops forever. |
---|
48 | </para> |
---|
49 | |
---|
50 | <para> |
---|
51 | When defining an external <literal>requester</literal> for a printer, it is important to wait for the printer being |
---|
52 | <literal>idle</literal> before asking it for its internal page counter, otherwise results could |
---|
53 | be inaccurate. If the printer is asked while the job is still being printed, then the page counter's |
---|
54 | value will be lower than expected with regard to the real job's size. |
---|
55 | </para> |
---|
56 | |
---|
57 | <para> |
---|
58 | <filename>papwaitprinter.sh</filename> can be used to be sure that <application>PyKota</application> |
---|
59 | waits until no job is being printed, and no paper sheet is travelling inside the printer. |
---|
60 | </para> |
---|
61 | |
---|
62 | <tip> |
---|
63 | <title>Tip</title> |
---|
64 | <para> |
---|
65 | See the sample configuration file <filename>conf/pykota.conf.sample</filename> for examples. |
---|
66 | </para> |
---|
67 | </tip> |
---|
68 | </sect1> |
---|
69 | |
---|
70 | <sect1> |
---|
71 | <title>mailandpopup.sh</title> |
---|
72 | <para> |
---|
73 | This script can be used in the <literal>mailto</literal> directive of <filename>pykota.conf</filename> |
---|
74 | to both send an email and display a <application>Winpopup</application> message on the user's screen, |
---|
75 | whenever print quota is low or reached. |
---|
76 | </para> |
---|
77 | |
---|
78 | <para> |
---|
79 | For this script to work successfully, you may need to have a <application>Samba</application> |
---|
80 | Primary Domain Controller. Some modifications may be needed in other configurations. |
---|
81 | </para> |
---|
82 | |
---|
83 | <tip> |
---|
84 | <title>Tip</title> |
---|
85 | <para> |
---|
86 | See the sample configuration file <filename>conf/pykota.conf.sample</filename> for examples. |
---|
87 | </para> |
---|
88 | </tip> |
---|
89 | </sect1> |
---|
90 | |
---|
91 | <sect1> |
---|
92 | <title>pagecount.pl</title> |
---|
93 | <para> |
---|
94 | This <application>Perl</application> script can be used in the <literal>requester</literal> directive of <filename>pykota.conf</filename>, |
---|
95 | to ask a printer for its internal page counter by sending a specially crafted <acronym>PJL</acronym> job |
---|
96 | to it over the AppSocket protocol, usually on <acronym>TCP</acronym> port 9100. |
---|
97 | It accepts the printer's hostname or <acronym>IP</acronym> address as its first parameter, |
---|
98 | and the optional <acronym>TCP</acronym> port as its second parameter (it defaults to 9100). |
---|
99 | </para> |
---|
100 | |
---|
101 | <para> |
---|
102 | Most of the time you'll use this script in combination with a script which waits for the printer |
---|
103 | to be in <literal>idle</literal> state, in something like : |
---|
104 | <screen> |
---|
105 | requester: external(somewaitscript.sh && pagecount.pl %(printer)s) |
---|
106 | </screen> |
---|
107 | </para> |
---|
108 | |
---|
109 | <tip> |
---|
110 | <title>Tip</title> |
---|
111 | <para> |
---|
112 | See the sample configuration file <filename>conf/pykota.conf.sample</filename> for examples. |
---|
113 | </para> |
---|
114 | </tip> |
---|
115 | </sect1> |
---|
116 | </chapter> |
---|
117 | |
---|
118 | <!-- |
---|
119 | |
---|
120 | $Log$ |
---|
121 | Revision 1.1 2004/03/16 14:42:31 jalet |
---|
122 | Improved documentation |
---|
123 | |
---|
124 | |
---|
125 | --> |
---|