# Introduction to PyKota

Last modified on $Date: 2006-12-03 12:26:33 +0100 (So, 03. Dez 2006) $

This chapter will briefly introduce you to PyKota, and will familiarize you with this software and its components.

## What is PyKota ?

PyKota is a print quota and print accounting software solution for GNU/Linux and compatible print servers.

PyKota currently supports the CUPS

Common UNIX Printing System

printing subsystem, although older releases also supported LPRng.

PyKota is distributed under the terms of the GNU General Public License of the Free Software Foundation. This means that you are allowed to use, modify or redistribute its code provided that you respect the terms of this license.

We believe that despite being a bit rough around the edges sometimes, PyKota offers an unmatched flexibility and probably all you want to do with a print quota software is either already included, easily scriptable with a few lines of shell scripting, or planned for the next release.

PyKota is however a somewhat complex piece of software, and installing it will mandate that you also install several dependencies beforehand, as you'll see in the next chapter.

PyKota is made of the following components :

- Configuration files, which must be placed into the system user `pykota`'s home directory as defined in `/etc/passwd`

  If your `/etc/passwd` contains something like `pykota:x:1001:1001:PyKota Admin,,,:/etc/pykota:/bin/sh` then the home directory is `/etc/pykota`

  :

  - `pykotadmin.conf` : this file contains sensitive database settings allowing the PyKota software to modify the print quota database. This file should be protected and should only be made readable by the administrators of PyKota and the system user the printing subsystem is running as. The possibility for a particular user to read this file determines if this user is a PyKota Administrator or not, so please give particular attention to this file's permissions.

  - `pykota.conf` : this is the main configuration file for PyKota. It contains database settings which allow the PyKota software to access to the print quota database in readonly mode, as well as global and print queue specific configuration directives. With a properly configured PyKota, letting normal users read this file is safe excepted where you want to forbid users to read other users' print quota information. However if you're not confident about your database settings, it's better to not let normal users read this file. This way they can't even use any of the PyKota command line tools.

- Either a PostgreSQL, MySQL or SQLite database, or an LDAP

  Lightweight Directory Access Protocol

  DIT

  Directory Information Tree

  : PyKota can store its datas into any of these. Support for other database backends might be added in a future release.

- A generic CUPS backend wrapper, named `cupspykota` : this software captures all print jobs passing through the print queues it manages, and does the accounting and quota checking. It can reject print jobs in a number of circumstances like the user being over quota, and interact with the end user through the use of external commands or shell scripts. This software is written in such a manner than system administrators can plug their own scripts at the most strategic points of the printing process, through specific directives that you put in PyKota's configuration files.

- Several command line tools to manage print quotas and accounting. All of these commands accept the `--version` and `--help` command line switches, and all have a manual page. Many manual pages are available in several native languages and contain usage examples. Some commands have many options and switches, so please read their help carefully.

  - `pksetup` : to install PyKota in a completely interactive way, but currently only under Debian and Ubuntu.

  - `pkturnkey` : to help you do the initial configuration and database initialization. This command almost transforms PyKota into a turn-key solution, hence the name.

  - `pkprinters` : to manage printers and printers groups.

  - `pkusers` : to manage users and users groups.

  - `edpykota` : to manage users' and users groups' print quota entries.

  - `pkbcodes` : to manage billing codes.

  - `repykota` : to do some basic print quota reporting.

  - `dumpykota` : to dump the database's contents in a portable way. This command can be used to export PyKota's datas to third party software, like print log analyzers or spreadsheets, and numerous output formats are supported, like csv and XML

  - `autopykota` : to automate the creation of user print accounts on first print. This command is not meant to be used from the command line, but instead from `pykota.conf`'s `policy` directive.

  - `pykosd` : to display their remaining credits or pages to end users. This is an OSD

    On Screen Display

    application which works under the X Window system.

  - `pykotme` : to give detailed quotes to end users before they print, this way they know in advance how much a print job will cost to them and can decide to route it to a less costly printer.

  - `pkbanner` : to generate dynamic banner pages when printing. This command is not meant to be used from the command line, but instead from `pykota.conf`'s `startingbanner` and `endingbanner` directives. If you prefer you can use your own generator of dynamic banner pages or even static banner pages.

  - `warnpykota` : to warn users over quota from time to time, for example from `crontab`. Users are warned while printing in any case, so this command is meant to be used as a periodic reminder.

  - `pkmail` : to let users obtain their print quota situation by email. In the future other functionnalities will be added. This command is not meant to be used from the command line, but instead as a pipe from your mail server's `/etc/aliases` file.

  - `pknotify` : a client for the PyKotIcon cross-platform generic network dialog box manager. This tools allow you to interact with end users at printing time.

  - `pkinvoice` : an invoice generator which can create personalized PDF invoices for your users from their printing history.

  - `pkrefund` : a tool with which you can refund print jobs when there was an accounting problem. It can generate printable receipts in the PDF format.

- Several CGI scripts which constitute PyKota's web interface. All these scripts behave differently when they are protected with an username and password compared to when they are not. See `pykota/cgi-bin/README` for details.

  - `printquota.cgi` : to do basic print quota reports like repykota, and also to examine the printing history, which is not possible with repykota for now.

  - `dumpykota.cgi` : identical to the `dumpykota` command line tool, but works from within a web browser.

  - `pykotme.cgi` : identical to the `pykotme` command line tool, but works from within a web browser.

- Several helper scripts and contributed stuff to handle very specific configurations. Please visit the subdirectories of the `pykota/` source directory, and you may find interesting things...