Useful Shell Scripts
Last modified on $Date$
PyKota comes with a number of shell scripts which
help do complex things. They can be used as-is, but you may prefer to adapt
them to your own configuration. All are installed in the /usr/share/pykota
directory.
waitprinter.sh
This script which accepts a printer's hostname or IP address as its first parameter
is used to wait for a printer which supports the SNMP protocol to be in idle state.
It exits as soon as the printer is idle, else loops forever.
When defining an external requester for a printer, it is important to wait for the printer being
idle before asking it for its internal page counter, otherwise results could
be inaccurate. If the printer is asked while the job is still being printed, then the page counter's
value will be lower than expected with regard to the real job's size.
waitprinter.sh can be used to be sure that PyKota
waits until no job is being printed, and no paper sheet is travelling inside the printer.
Tip
See the sample configuration file conf/pykota.conf.sample for examples.
papwaitprinter.sh
This script which accepts a printer's AppleTalk name as its first parameter
is used to wait for a printer which supports the AppleTalk protocol to be in idle state.
It exits as soon as the printer is idle, else loops forever.
When defining an external requester for a printer, it is important to wait for the printer being
idle before asking it for its internal page counter, otherwise results could
be inaccurate. If the printer is asked while the job is still being printed, then the page counter's
value will be lower than expected with regard to the real job's size.
papwaitprinter.sh can be used to be sure that PyKota
waits until no job is being printed, and no paper sheet is travelling inside the printer.
Tip
See the sample configuration file conf/pykota.conf.sample for examples.
mailandpopup.sh
This script can be used in the mailto directive of pykota.conf
to both send an email and display a Winpopup message on the user's screen,
whenever print quota is low or reached.
For this script to work successfully, you may need to have a Samba
Primary Domain Controller. Some modifications may be needed in other configurations.
Tip
See the sample configuration file conf/pykota.conf.sample for examples.
pagecount.pl
This Perl script can be used in the requester directive of pykota.conf,
to ask a printer for its internal page counter by sending a specially crafted PJL job
to it over the AppSocket protocol, usually on TCP port 9100.
It accepts the printer's hostname or IP address as its first parameter,
and the optional TCP port as its second parameter (it defaults to 9100).
Most of the time you'll use this script in combination with a script which waits for the printer
to be in idle state, in something like :
requester: external(somewaitscript.sh && pagecount.pl %(printer)s)
Tip
See the sample configuration file conf/pykota.conf.sample for examples.