[1406] | 1 | <!-- $Id$ --> |
---|
| 2 | |
---|
| 3 | <chapter> |
---|
| 4 | <title>Useful Shell Scripts</title> |
---|
| 5 | <para>Last modified on $Date$</para> |
---|
[3413] | 6 | |
---|
[1406] | 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. |
---|
[3413] | 12 | </para> |
---|
| 13 | |
---|
[1406] | 14 | <sect1> |
---|
| 15 | <title>waitprinter.sh</title> |
---|
| 16 | <para> |
---|
[3413] | 17 | This script which accepts a printer's hostname or <acronym>IP</acronym> address as its first parameter |
---|
[1406] | 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> |
---|
[3413] | 21 | |
---|
[1406] | 22 | <para> |
---|
[1483] | 23 | When defining an hardware <literal>accounter</literal> for a printer, it is important to wait for the printer being |
---|
[1406] | 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> |
---|
[3413] | 28 | |
---|
[1406] | 29 | <para> |
---|
[2551] | 30 | <command>waitprinter.sh</command> can be used to be sure that <application>PyKota</application> |
---|
[3413] | 31 | waits until no job is being printed, and no paper sheet is travelling inside the printer. |
---|
[1406] | 32 | </para> |
---|
[3413] | 33 | |
---|
[1406] | 34 | <tip> |
---|
| 35 | <title>Tip</title> |
---|
| 36 | <para> |
---|
| 37 | See the sample configuration file <filename>conf/pykota.conf.sample</filename> for examples. |
---|
| 38 | </para> |
---|
[3413] | 39 | </tip> |
---|
[1406] | 40 | </sect1> |
---|
[3413] | 41 | |
---|
[1406] | 42 | <sect1> |
---|
| 43 | <title>papwaitprinter.sh</title> |
---|
| 44 | <para> |
---|
[3413] | 45 | This script which accepts a printer's AppleTalk name as its first parameter |
---|
[1406] | 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> |
---|
[3413] | 49 | |
---|
[1406] | 50 | <para> |
---|
[1483] | 51 | When defining an hardware <literal>accounter</literal> for a printer, it is important to wait for the printer being |
---|
[1406] | 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> |
---|
[3413] | 56 | |
---|
[1406] | 57 | <para> |
---|
[2551] | 58 | <command>papwaitprinter.sh</command> can be used to be sure that <application>PyKota</application> |
---|
[3413] | 59 | waits until no job is being printed, and no paper sheet is travelling inside the printer. |
---|
| 60 | </para> |
---|
| 61 | |
---|
[1406] | 62 | <tip> |
---|
| 63 | <title>Tip</title> |
---|
| 64 | <para> |
---|
| 65 | See the sample configuration file <filename>conf/pykota.conf.sample</filename> for examples. |
---|
| 66 | </para> |
---|
[3413] | 67 | </tip> |
---|
[1406] | 68 | </sect1> |
---|
[3413] | 69 | |
---|
[1406] | 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> |
---|
[3413] | 77 | |
---|
[1406] | 78 | <para> |
---|
[3413] | 79 | For this script to work successfully, you may need to have a <application>Samba</application> |
---|
[1406] | 80 | Primary Domain Controller. Some modifications may be needed in other configurations. |
---|
| 81 | </para> |
---|
[3413] | 82 | |
---|
[1406] | 83 | <tip> |
---|
| 84 | <title>Tip</title> |
---|
| 85 | <para> |
---|
| 86 | See the sample configuration file <filename>conf/pykota.conf.sample</filename> for examples. |
---|
| 87 | </para> |
---|
[3413] | 88 | </tip> |
---|
[1406] | 89 | </sect1> |
---|
[3413] | 90 | |
---|
[1406] | 91 | <sect1> |
---|
| 92 | <title>pagecount.pl</title> |
---|
| 93 | <para> |
---|
[1483] | 94 | This <application>Perl</application> script can be used in the <literal>accounter</literal> directive of <filename>pykota.conf</filename>, |
---|
[1406] | 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). |
---|
[3413] | 99 | </para> |
---|
| 100 | |
---|
[1406] | 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 : |
---|
[3413] | 104 | <screen> |
---|
[1483] | 105 | accounter: hardware(somewaitscript.sh && pagecount.pl %(printer)s) |
---|
[1406] | 106 | </screen> |
---|
| 107 | </para> |
---|
[3413] | 108 | |
---|
[1406] | 109 | <tip> |
---|
| 110 | <title>Tip</title> |
---|
| 111 | <para> |
---|
| 112 | See the sample configuration file <filename>conf/pykota.conf.sample</filename> for examples. |
---|
| 113 | </para> |
---|
[3413] | 114 | </tip> |
---|
[1406] | 115 | </sect1> |
---|
| 116 | </chapter> |
---|
| 117 | |
---|