LPRng-HOWTO: 15 Oct 2001 (For LPRng-3.7.9)
Prev | Chapter 18. Accounting | Next

# 18.4. Authorization and Quotas

In addition to simply recording accounting information the accounting procedures can be used to check print quotas or update databases. This is done by using the Accounting Check `:achk` flag and the `:as`, `:ae`, and `:af` network connection or program capabilities.

If the `:achk` flag is set and the `:as=` option specifies a program to be run, or the `:af=` option specifies a program to be run or a network connection then output of the program or information read from the network connection is used to control the handling of the job. If the `:as=` option specifies a program to be run then the program is run and the exit code and output is saved. If the `:as=` option specifies a string and the `:af=` option specifies a program to be run or a remote host to be contacted then the `:as=` value is written to the program STDIN or remote host. The program STDOUT or network connection is read and saved and the program exit code is saved.

If the information was read from a program, then the exit code of the program is checked:

        Exit Code    Action
        JSUCC (0)    process data read
        JFAIL        retry with JFAIL status
        JHOLD        hold job
        JREMOVE      remove job
        JABORT       abort processing jobs
        other        abort processing jobs

If the information was read from a network connection or the program exited with JSUCC (0) then the start of the first line of the information read is used. If this line starts with the following case insensitive words then the following actions are taken:

        Word         Action
        (blank)      process job
        ACCEPT       process job
        FAIL         retry with JFAIL status
        HOLD         hold job
        REMOVE       remove job
        (other)      abort processing jobs

These facilities can be used to implement a wide variety of quota mechanisms. The most simple method is to create a script or program that can be run as the `:as=` program. This would connect to a database server or check a database to see if user quotas had been exceeded. If they had, then it would return a `REMOVE` or `HOLD` status as appropriate.

Prev | Home | Next
Accounting File | Up | Accessing Printer Hardware Pagecounters