ftp.nice.ch/pub/next/tools/system/Quotas.README

This is the README for Quotas.N.bs.tar.gz [Download] [Browse] [Up]




Disk Space and Page Usage Quota Systems
Marc Majka


This package contains software for quota systems for disk space usage and printer page usage.  It was written for the University of British Columbia Computer Science Department first-year Computer Science Laboratory.

Quotas are recorded under NetInfo, and may be managed through NetInfoManager, UNIX system command-line utilities, or the Quotas Application.  The latter is designed to allow users to examine their own usage and quotas, and to permit managers to change quotas or reset usages.


0: Caveat Administrator
This package is free for you to use and modify.  It is unsupported, and has parts that are not terribly elegant.  The page usage software only works with non-NeXT printers.  If your printer is hosted by a machine other than the NetInfo master, you will introduce a security hole to use the page accounting.

1: Location
Software, reports, and source code is stored in a single directory. Access to this directory should be permitted only to root and members of an administrative group.  See the installation notes below.

2: NetInfo
New properties are added to the NetInfo user directories.  They are diskquota, pagequota, and pageusage.  The quota software will use default values of 0 for all these properties if they have not been added to a user's NetInfo entry.  Two programs have been written to get and set netinfo properties for all users.  getall property prints user names and values for the given property.  setall property value sets the given property to the given value for all users.  These are extraordinarily powerful programs, which could cause havoc in NetInfo if used improperly.  Please be carefull.

2.1 Files and Software
setall	Usage: setall property value. Sets property for all users.
getall	Usage: getall property.  Prints property value for all users.
Source/netinfo/*	Source files.

3: Disk space quotas
Disk usage is monitored by Nightly, which should be invoked by cron.  This script first produces a report using QuotaCheck.  The report lists name, diskquota, and diskusage for each user.  The Nightly script then runs ProcessReport, which constructs lists of users over their quota, and within 20% of their quota.  Mail messages are sent to the users on each list informing them of their usage.   QuotaCheck ages the over-quota list for 10 days.  The most recent over-quota list is called over.  The over-quota list for the previous days are kept in over.1 to over.9.  Nightly then runs DisableOver, which disables the account of anyone over disk quota for 7 of the last 10 days.  A list of disabled accounts is written to the file disabled.

3.1: Files and Software
Nightly	Script run by cron.
QuotaCheck	Run by Nightly.  Output file is report.  Ages over files.
ProcessReport	Run by Nightly.  Input is report, outputs are over and low.
		Sends mail to users in over and low, unless run with "-m".
DisableOver	Disables accounts over quota for 7 of of the last 10 days.
disable	Usage: disable user.  Used by DisableOver.
enable	Usage: enable user.  Re-enables user accounts.
disabled	List of disabled accounts.
log    	Date and error messages from Nightly.
report	List of the form name diskquota diskusage.
low	List of users with disk usage within 20% of disk space quota.
over	List of users over disk space quota.
over.[1-9]	Aged over files.
mail	Temporary file used to construct mail messages.
setdq	Usage: setdq user quota.  Sets disk space quota for user.
getdq	Usage: getdq user.  Prints disk quota for user.
getdu	Usage: getdu user.  Prints disk usage for user.
/usr/lib/crontab	Invokes Nightly.
Source/diskq/*	Source files.

4: Printer page quotas
Printer page usage is counted by /usr/lib/transcript/psif.  The printer is queried before and after every print job by pagecount to determine the page count.  The value of the pageusage property in the NetInfo entry for the user doing the printing is updated by /usr/lib/transcript/updatepage.  This program is actually a copy of addpu.  When pageusage is over pagequota the printjob is cancelled, and a cancellation page is printed.

4.1: Files and Software
setpq	Usage: setpq user quota  Sets printer page quota for user.
getpq	Usage: getpq user.  Prints page quota for user.
setpu	Usage: setpu user usage  Sets printer page usage for user.
getpu	Usage: getpu user.  Prints page usage for user.
addpu	Usage: addpu user pages.  Adds pages to pageusage for user.
pagecount	Usage: pagecount device. Gets and prints a page count from a printer.
/usr/lib/transcript/psif
		Printer output filter modified to maintain pageusage.
		Cancels print jobs if the user is over quota.
/usr/lib/transcript/updatepage
		A copy of addpu.
exceeded.ps	Prototype cancellation page.
		%%Title modified to Page Quota Exceeded.
		%%Creator modified to Accounting.
Source/pageq/*	Source Files.
5: Quotas application
A NextStep application program for examining and managing quotas and usage is available in Quotas.  It presents the user with a window containing the user's login name, current disk usage, disk quota, page usage and page quota.  The application's menu contains a Manager item.  When selected, an authorization window appears and prompts for a password.  If the system root password is entered, the program will allow one to examine and change quotas and page usage for any user, selected by entering their name into the User TextField.

5.1: Files and Software
Quotas	Quota Application
Source/Quotas/*	Source Files

6: Installation
X	Set the name of the installation directory  in Nightly.  It is currently set to 	/Users/Admin/Quotas.

X	/usr/lib/crontab should invoke Nightly with an entry like:
	0 4 * * *       root    /bin/sh /Users/Admin/Quotas/Nightly

X	Copy Source/pageq/psif to /usr/lib/transcript on the printer server.

X	Copy addpu to /usr/lib/transcript/updatepage on the printer server.
	If your printer is not served by the NetInfo master, then you will need to use the 	version of addpu in addpu.root.c.  Read the README file in Source/pageq, 	and the comments in the code.

X	Copy pagecount to /usr/lib/transcript on the printer server.  pagecount keeps a log 	file in /usr/adm/printlog.  If you want to change this, edit the source and recompile.  	This code should work on most PostScript printers, but your milage may vary.  Note 	that this code does not work for a NeXT printer, which appears to be connected to 	/dev/null (lp = /dev/null in NetInfo), and doesn't have a PostScript interpreter that 	pagecount can to ask for a pagecount.

These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.