Changeset 1600
- Timestamp:
- 07/16/04 14:22:47 (20 years ago)
- Location:
- pykota/trunk
- Files:
-
- 1 added
- 12 modified
Legend:
- Unmodified
- Added
- Removed
-
pykota/trunk/bin/cupspykota
r1584 r1600 24 24 # 25 25 # $Log$ 26 # Revision 1.67 2004/07/16 12:22:45 jalet 27 # LPRng support early version 28 # 26 29 # Revision 1.66 2004/07/01 19:56:25 jalet 27 30 # Better dispatching of error messages … … 471 474 maskval.append("POLLNVAL") 472 475 return "%s (%s)" % (fd, " | ".join(maskval)) 473 474 def sendBackChannelData(self, message) :475 """Sends an informational message to CUPS via back channel stream (stderr)."""476 self.printInfo("PyKota (PID %s) : %s" % (os.getpid(), message.strip()))477 476 478 477 def handleData(self) : -
pykota/trunk/docs/filterpykota.sgml
r1500 r1600 11 11 <para> 12 12 PyKota doesn't currently account for ink usage, it only accounts 13 pages. To account for ink usage, you should use PrintBill instead .13 pages. To account for ink usage, you should use PrintBill instead for now. 14 14 </para> 15 15 </footnote> … … 26 26 PostScript data as its input, and, as its name implies, outputs PostScript data too, but after having 27 27 eventually rearranged the pages to fit several pages on a single sheet of paper, or other manipulations 28 like that. 28 like that. <application>LPRng</application> also contains several filters like this. 29 29 </para> 30 30 … … 36 36 37 37 <para> 38 <application>LPRng</application> can also use filters, one often used in combination with 39 <application>LPRng</application> is <application>magicfilter</application> which can convert 40 different input formats to native printers languages like PostScript or ESC/P2. 38 <application>LPRng</application> can also use filters, often used in combination with 39 <application>LPRng</application> are <application>magicfilter</application> which can convert 40 different input formats to native printers languages like PostScript or ESC/P2 and 41 <application>ifhp</application> which can do low-level accounting. 41 42 </para> 42 43 … … 44 45 So to do its own accounting, <application>PyKota</application> has its own filters, for <application>CUPS</application> 45 46 it's named <filename>cupspykota</filename>, which is in fact a <application>CUPS</application> backends wrapper, 46 and for <application>LPRng</application> it's named ########## TODO ##########.47 and for <application>LPRng</application> it's named <filename>lprngpykota</filename>, as you have probably guessed. 47 48 The procedure to plug the correct filter into your printing system is described in the 48 49 <xref linkend="installation" endterm="installation"> chapter. … … 52 53 Currently with a <application>CUPS</application> internal accounting mechanism, the <filename>pstops</filename> 53 54 filter can be bypassed. That's why <application>PyKota</application> uses its own backend. 54 The <filename>cupspykota</filename> backend wrapper ensures that jobs can't bypass the filtering mechanism, so you can use55 The <filename>cupspykota</filename> backend wrapper ensures that jobs can't bypass it, so you can use 55 56 any printer with any driver and any command line option, and you can be sure that your 56 57 print job will be correctly accounted for. … … 58 59 59 60 <para> 60 When used with an <application>LPRng</application> backend, the accounting filter is not defined the same way61 input filters are, so the problem described above doesn't exist, and <application>PyKota</application>62 may work with non-postscript printers, provided they can report their page counter and you know how to retrieve63 it.64 </para>65 66 <para>67 When you submit a print job, <application>PyKota</application>'s accounting mechanism is automatically launched by your printing system,68 so it has to detect which system you are using (<application>CUPS</application> or <application>LPRng</application>)69 and behave like if it was specifically designed for your printing system. Fortunately there's not a lot70 of differences, the more important one is the exit codes used to tell the printing environment if a job71 has to be accepted or rejected.72 </para>73 74 <para>75 61 When using the <literal>hardware</literal> accounting method, 76 the <application>cupspykota</application> CUPS backend77 ask sthe printer for its internal page counter at the start and at the end of the print job, and78 computes the values' difference so accounting is done immediately.62 <application>PyKota</application> launches the script you specified to 63 ask the printer for its internal page counter at the start and at the end of the print job, and 64 computes the values' difference to know the job's size. 79 65 </para> 80 66 81 67 <para> 82 68 When using the <literal>software</literal> accounting method, 83 and if the user is still allowed to print,84 69 the command you specified is launched with the job's data on its 85 70 standard input. Your command must print the job's size in number of 86 71 pages on a single line on its standard output. This number is then 87 72 read by <application>PyKota</application> and used to update the current user's quota information. 88 Of course checks are also done like with the <literal>hardware</literal>89 accounting method, to see if the current job is allowed to be printed or not.90 73 </para> 91 74 … … 103 86 104 87 $Log$ 88 Revision 1.12 2004/07/16 12:22:45 jalet 89 LPRng support early version 90 105 91 Revision 1.11 2004/05/25 09:49:52 jalet 106 92 The old pykota filter has been removed. LPRng support disabled for now. -
pykota/trunk/docs/installation.sgml
r1500 r1600 29 29 have to decompress and visit its archive, to do so just type the following commands : 30 30 <screen> 31 jerome@nordine:~$ tar -zxf pykota-1.1 8_official.tar.gz32 jerome@nordine:~$ cd pykota-1.1 8_official33 jerome@nordine:~/pykota-1.1 8_official$31 jerome@nordine:~$ tar -zxf pykota-1.19_official.tar.gz 32 jerome@nordine:~$ cd pykota-1.19_official 33 jerome@nordine:~/pykota-1.19_official$ 34 34 </screen> 35 35 </para> … … 152 152 <filename>initscripts/postgresql/pykota-postgresql.sql</filename> file 153 153 accordingly, and report your changes into <application>PyKota</application>'s 154 configuration file .154 configuration files. 155 155 </para> 156 156 </note> … … 165 165 From a command line interpreter (i.e. shell), type the following commands : 166 166 <screen> 167 jerome@nordine:~$ cd pykota-1.1 8_official/initscripts/postgresql168 jerome@nordine:~/pykota-1.1 8_official/initscripts$ psql -h localhost -U postgres template1167 jerome@nordine:~$ cd pykota-1.19_official/initscripts/postgresql 168 jerome@nordine:~/pykota-1.19_official/initscripts$ psql -h localhost -U postgres template1 169 169 Welcome to psql, the PostgreSQL interactive terminal. 170 170 … … 197 197 ALTER USER 198 198 pykota=# \q 199 jerome@nordine:~/pykota-1.1 8_official/initscripts/postgresql$199 jerome@nordine:~/pykota-1.19_official/initscripts/postgresql$ 200 200 </screen> 201 201 </para> … … 210 210 take any other step as needed. Please refer to <application>PostgreSQL</application>'s 211 211 documentation for details. Also if <application>PyKota</application>'s configuration 212 file <filename>/etc/pykota/pykotadmin.conf</filename> is readable by anyone with access on your file system, a local user could213 create some script to modify his own print quota.212 file <filename>/etc/pykota/pykotadmin.conf</filename> is readable by anyone with access on your file system, 213 a local user could create some script to modify his own print quota. 214 214 <warning> 215 215 <title>Warning</title> … … 248 248 <para> 249 249 From version 1.09 on, <application>OpenLDAP</application> can be used as a Quota Storage Backend. 250 It is possible that other LDAP servers can be used, but this is currently untested.250 Some other LDAP servers can be used, but this is currently untested in production. 251 251 </para> 252 252 … … 283 283 While this is not mandatory, it is recommended that you setup 284 284 some indexes for some often accessed PyKota attributes. 285 Actually, the <acronym>LDAP</acronym> schema included with 286 PyKota doesn't allow indexes of another type than <literal>eq</literal>, 287 but this will change in a next release. Here are the minimal indexes 285 Here are the minimal indexes 288 286 lines you may want to put in <filename>slapd.conf</filename> : 289 287 <screen> 290 288 # Indexes for PyKota 291 index pykotaUserName eq292 index pykotaGroupName eq293 index pykotaPrinterName eq289 index pykotaUserName pres,eq,sub 290 index pykotaGroupName pres,eq,sub 291 index pykotaPrinterName pres,eq,sub 294 292 index pykotaLastJobIdent eq 295 293 </screen> 294 </para> 295 296 <para> 297 Now you must ensure that the DNs you'll use to bind to 298 your OpenLDAP server don't have search queries size limits, 299 which gives for example (OpenLDAP 2.1.x or above) : 300 301 <screen> 302 # No Limits for PyKota's administrator and read-only user 303 limits dn="cn=RWadmin,dc=example,dc=com" size.soft=-1 size.hard=soft 304 limits dn="cn=ROadmin,dc=example,dc=com" size.soft=-1 size.hard=soft 305 </screen> 306 307 Where RWadmin and ROadmin are the usernames used to bind to your 308 OpenLDAP server within PyKota, respectively in ReadWrite mode 309 (as set in pykotadmin.conf) and in ReadOnly mode (as set in pykota.conf). 296 310 </para> 297 311 … … 381 395 <para> 382 396 <application>CUPS</application> version 1.1 or above, or <application>LPRng</application> 383 version 3.8.2 0or above (it probably works with older versions but this is untested).397 version 3.8.27 or above (it probably works with older versions but this is untested). 384 398 You can download them from <ulink url="http://www.cups.org">http://www.cups.org</ulink> 385 399 or <ulink url="http://lprng.sourceforge.net">http://lprng.sourceforge.net</ulink> … … 532 546 Please create a backup of the <filename>/etc/pykota</filename> 533 547 directory before modifying anything. 534 Under some circumstances, the setup PyKotamay refuse to install PyKota548 Under some circumstances, PyKota's setup script may refuse to install PyKota 535 549 until you have modified your configuration. Just do it and restart 536 550 the installation script as described above. … … 611 625 <para> 612 626 Then when creating new printers or reconfiguring existing ones, just 613 choose devices which are <literal>PyKota managed</literal> instead of 627 choose devices which are <literal>PyKota managed</literal> 628 <footnote> 629 <para> 630 Debian 3.0 Woody is known to have problems : CUPS 1.1.14 doesn't automatically 631 detect <literal>PyKota managed</literal> devices. So you have to manually 632 modify CUPS' <filename>printers.conf</filename> file as explained in 633 PyKota's toplevel <filename>README</filename> file. 634 </para> 635 </footnote> 636 instead of 614 637 normal devices. You've got one <literal>PyKota managed</literal> device 615 638 for each regular device available from CUPS, so just choose the appropriate … … 645 668 <sect2> 646 669 <title>With LPRng</title> 647 <para> 648 ######### TODO ########## 649 </para> 650 651 <para> 652 You have to restart <application>LPRng</application> for this modification to 653 take effect : 670 671 <para> 672 For each printer on which you want to use <application>PyKota</application>, just modify the printer's 673 entry in <filename>/etc/printcap</filename> : you have to add 674 the three following lines : 675 676 <screen> 677 :ac=true:\ 678 :as=/usr/share/pykota/lprngpykota:\ 679 :ae=/usr/share/pykota/lprngpykota:\ 680 </screen> 681 682 This will tell <application>LPRng</application> to activate accounting, and use the <filename>lprngpykota</filename> 683 accounting filter both at the start and at the end of printing. 684 </para> 685 686 687 <para> 688 Repeat the above procedure for each print queue on which you want to use 689 PyKota. That's all ! 690 </para> 691 692 <para> 693 When all modifications are done, just save the <filename>/etc/printcap</filename> file 694 and restart <application>LPRng</application> for the changes to take effect : 654 695 <screen> 655 696 $ /etc/init.d/lprng restart 656 697 </screen> 657 </para>658 659 <para>660 Repeat the above procedure for each print queue on which you want to use661 PyKota. That's all !662 698 </para> 663 699 … … 689 725 690 726 $Log$ 727 Revision 1.26 2004/07/16 12:22:46 jalet 728 LPRng support early version 729 691 730 Revision 1.25 2004/05/25 09:49:53 jalet 692 731 The old pykota filter has been removed. LPRng support disabled for now. -
pykota/trunk/docs/pykota.sgml
r1409 r1600 10 10 <!entity SCRIPTS system "scripts.sgml"> 11 11 <!entity PKHINT system "pkhint.sgml"> 12 <!entity PYKOSD system "pykosd.sgml"> 12 13 <!entity GNUGPL system "gnugpl.sgml"> 13 14 … … 120 121 121 122 &PKHINT; 123 124 &PYKOSD; 122 125 123 126 &GNUGPL; … … 128 131 129 132 $Log$ 133 Revision 1.13 2004/07/16 12:22:46 jalet 134 LPRng support early version 135 130 136 Revision 1.12 2004/03/18 10:32:23 jalet 131 137 Added pkhint's documentation -
pykota/trunk/MANIFEST.in
r1595 r1600 1 include README FAQ COPYING LICENSE TODO NEWS CREDITS SECURITY MANIFEST.in clean.sh bin/ cupspykota bin/edpykota bin/warnpykota bin/repykota bin/pykotme bin/pykosd bin/pkprinters bin/pkhint bin/pkpgcounter bin/snmpprinterstatus bin/waitprinter.sh bin/papwaitprinter.sh bin/mailandpopup.sh bin/README1 include README FAQ COPYING LICENSE TODO NEWS CREDITS SECURITY MANIFEST.in clean.sh bin/lprngpykota bin/cupspykota bin/edpykota bin/warnpykota bin/repykota bin/pykotme bin/pykosd bin/pkprinters bin/pkhint bin/pkpgcounter bin/snmpprinterstatus bin/waitprinter.sh bin/papwaitprinter.sh bin/mailandpopup.sh bin/README 2 2 recursive-include po README *.po *.mo *.pot 3 3 recursive-include man README *.sh *.1 -
pykota/trunk/NEWS
r1599 r1600 22 22 PyKota NEWS : 23 23 24 - 1.19alpha32 : 25 26 - Early (not working) version of the LPRng support rewrite 27 24 28 - 1.19alpha31 : 25 29 -
pykota/trunk/pykota/accounter.py
r1499 r1600 22 22 # 23 23 # $Log$ 24 # Revision 1.17 2004/07/16 12:22:47 jalet 25 # LPRng support early version 26 # 24 27 # Revision 1.16 2004/05/25 09:15:15 jalet 25 28 # accounter.py : old code deleted … … 91 94 self.filter = kotafilter 92 95 self.arguments = arguments 96 self.isSoftware = 1 # by default software accounting 93 97 94 98 def getLastPageCounter(self) : -
pykota/trunk/pykota/accounters/hardware.py
r1584 r1600 22 22 # 23 23 # $Log$ 24 # Revision 1.7 2004/07/16 12:22:47 jalet 25 # LPRng support early version 26 # 24 27 # Revision 1.6 2004/07/01 19:56:42 jalet 25 28 # Better dispatching of error messages … … 54 57 """Initializes querying accounter.""" 55 58 AccounterBase.__init__(self, kotabackend, arguments) 59 self.isSoftware = 0 56 60 57 61 def getPrinterInternalPageCounter(self) : -
pykota/trunk/pykota/tool.py
r1593 r1600 22 22 # 23 23 # $Log$ 24 # Revision 1.112 2004/07/16 12:22:47 jalet 25 # LPRng support early version 26 # 24 27 # Revision 1.111 2004/07/06 18:09:42 jalet 25 28 # Reduced the set of invalid characters in names … … 931 934 signal.signal(signal.SIGTERM, self.sigterm_handler) 932 935 936 def sendBackChannelData(self, message) : 937 """Sends an informational message to CUPS via back channel stream (stderr).""" 938 self.printInfo("PyKota (PID %s) : %s" % (os.getpid(), message.strip())) 939 933 940 def openJobDataStream(self) : 934 941 """Opens the file which contains the job's datas.""" … … 1105 1112 self.printInfo(_("Printer hostname undefined, set to 'localhost'"), "warn") 1106 1113 rseen = "localhost" 1114 try : 1115 df_name = [line[8:] for line in os.environ.get("HF").split() if line.startswith("df_name=")][0] 1116 except IndexError : 1117 inputfile = None 1118 else : 1119 inputfile = os.path.join(os.environ.get("SPOOL_DIR", "."), df_name) 1107 1120 if jseen and Pseen and nseen and rseen : 1108 # job is always in stdin (None) 1109 return ("LPRNG", rseen, Pseen, nseen, jseen, None, Kseen, None, None, None) 1121 return ("LPRNG", rseen, Pseen, nseen, jseen, inputfile, Kseen, None, None, None) 1110 1122 self.printInfo(_("Printing system unknown, args=%s") % " ".join(sys.argv), "warn") 1111 1123 return (None, None, None, None, None, None, None, None, None, None) # Unknown printing system -
pykota/trunk/pykota/version.py
r1599 r1600 22 22 # 23 23 24 __version__ = "1.19alpha3 1_unofficial"24 __version__ = "1.19alpha32_unofficial" 25 25 26 26 __doc__ = """PyKota : a complete Printing Quota Solution for CUPS and LPRng.""" -
pykota/trunk/README
r1580 r1600 25 25 FROM THIS FILE, PYKOTA CAN'T BE USED ANYMORE WITH LPRNG. 26 26 27 SUPPORT FOR LPRNG SHOULD BE RE-ADDED SOON WHEN A HUGE REWRITE 28 OF SOME PARTS OF PYKOTA WILL HAVE TAKEN PLACE 27 LPRNG SUPPORT IS CURRENTLY BEING REWRITTEN, AND YOU CAN 28 ALREADY PLAY WITH IT, BUT DON'T USE IT IN PRODUCTION UNTIL 29 THIS NOTE IS REMOVED. 29 30 30 31 ==================================================================== … … 47 48 - Supports both CUPS and LPRng as the printing system. 48 49 49 NB : LPRng support is currently being rewritten, so50 LPRng is actually not supported in latest CVS versions.51 52 50 Databases : 53 51 … … 174 172 counter. 175 173 176 With CUPS, this is done both at the beginning and at the end of a174 This is done both at the beginning and at the end of a 177 175 print job. The counters difference is then immediately used to 178 176 decrease the user's account balance or increase his quota usage. 179 180 With LPRng, this is done just before the beginning of a job, and used181 this to modify the *preceding* user's quota. So you're always late182 of one print job, but this is generally ok.183 177 184 178 - The 'software' method consists in delegating the computation of the … … 186 180 The command can read the job's data from its standard input and MUST 187 181 output the job's size on its standard output. Changes to the user 188 account are reported immediately, both with CUPS and LPRng. 189 190 PyKota is known to work fine with HP Laserjet 2100 and 2200, and 191 Apple LaserWriter 16/600 PS, both with CUPS and LPRng, under 192 Debian GNU/Linux (Sarge and Sid) operating systems. It should work 193 fine with most network printers. 182 account are reported immediately. 183 184 PyKota is known to work fine with most laser printers, either with 185 software accounting, or with hardware accounting if the printer 186 supports this. 194 187 195 188 ============================================================ … … 237 230 238 231 Other architectures may be supported as well in the future, check 239 on Psyco's website.232 this on Psyco's website. 240 233 241 234 Installing Psyco is not mandatory, but it will speedup PCL5 parsing … … 244 237 is already optimal. For PCL5 this is a completely different matter, 245 238 and if you install Psyco you will never regret it ! 246 Same remark applies for PCL6 (aka PCLXL) but performance improvement247 is yet to be fully tested (it is very high anyway).239 Same remark applies for PCL6 (aka PCLXL) : the parser is completely 240 different, but the performance gain with Psyco is impressive. 248 241 249 242 You may also benefit from having the following tools installed to … … 268 261 the Print Server. The PostgreSQL client libraries' version must 269 262 match the PostgreSQL version used on the Quota Storage Server. 270 BEWARE : under Debian Sarge, as of March 15th 2004, there's a271 problem with python2.2-pygresql and python-2.3-pygresql, so please272 install python2.1-pygresql and use Python 2.1 to install and run273 PyKota. This is not a bug in PyKota, and this should be fixed274 by Debian in a few days I hope.275 263 276 264 or … … 307 295 308 296 Go to the initscripts subdirectory of PyKota's sources, and choose 309 the appropriate storage backend for your configuration. Read 297 the appropriate storage backend for your configuration. Read carefully 310 298 the associated README file and execute the initialization script 311 299 to create an empty PyKota Storage. Upgrade scripts may be … … 314 302 Copy the conf/pykota.conf.sample and conf/pykotadmin.conf.sample 315 303 sample configuration files to /etc/pykota/pykota.conf and 316 /etc/pykota/pykotadmin.conf . The installation script tries to do317 this for you if needed and you agreed to this action . You need to318 adapt these files to your own needs. Especially you have to create304 /etc/pykota/pykotadmin.conf (the installation script tries to do 305 this for you if needed and you agreed to this action). You need to 306 adapt these files to your own needs. Especially you may have to create 319 307 sections named after your own printers, and change the 320 308 administrator's email address which by default is root@localhost. … … 342 330 $ /etc/init.d/cupsys restart 343 331 332 or : 333 334 $ /etc/rc.d/init.d/cupsysrestart 335 336 or any similar command depending on your operating system. 337 344 338 For new printers : 345 339 … … 358 352 359 353 Now double check /etc/pykota/pykota.conf 360 This file should contain a section named after the 354 355 You should manually create a section named after the 361 356 printer you've just added, unless you have set 362 357 all options globally. 358 363 359 The new pkhint command can help you with correct settings 364 360 for your printers, but don't rely on it because it is still 365 incomplete. 361 experimental work. To use pkhint, you have to feed it with 362 CUPS' printers.conf file this way : 363 364 $ pkhint </etc/cups/printers.conf 365 366 pkhint will try to tell you what is the best accounting 367 method for each printer and will print some lines you'll 368 just have to copy&paste in the appropriate sections in 369 /etc/pykota/pykota.conf 366 370 367 371 That's all. … … 399 403 400 404 Save the file and restart CUPS. 405 406 Here too, you may find it interesting to use the pkhint command as 407 described above to help with manual configuration of the file 408 /etc/pykota/pykota.conf 401 409 402 410 - LPRng Printing System : 403 411 404 For now LPRng support in PyKota is deactivated. Please be patient. 412 For each printer on which you want to use PyKota : 413 414 Modify the printer's entry in /etc/printcap : you have to add 415 the three following lines : 416 417 :ac=true:\ 418 :as=/usr/share/pykota/lprngpykota:\ 419 :ae=/usr/share/pykota/lprngpykota:\ 420 421 This will tell LPRng to activate accounting, and use the lprngpykota 422 accounting filter both at the start and at the end of printing. 423 424 When all modifications are done, just save the /etc/printcap file and 425 restart LPRng : 426 427 $ /etc/init.d/lprng restart 428 429 or : 430 431 $ /etc/rc.d/init.d/lprng restart 432 433 or any similar command depending on your operating system. 434 435 NB : the pkhint command can't be used with LPRng for now, so you 436 have to modify /etc/pykota/pykota.conf carefully. The comments 437 in this file will help you. 405 438 406 439 Now you can begin to populate the PyKota's database with printers, … … 489 522 http://cgi.librelogiciel.com/mailman/listinfo/pykota 490 523 524 The mailing list is the preferred way to obtain support, because 525 all members can help and can also benefit from the solutions 526 proposed by other members. 527 528 Posts by non-members are usually rejected. 529 530 The mailing list language is english and only english. 531 491 532 IRC : 492 533 ----- … … 496 537 /server irc.freenode.net 497 538 /join #pykota 539 540 Preferred language on this channel is english, but french 541 is also accepted. Try to avoid exposing complex problems 542 in french because english speaking people on the channel 543 wouldn't benefit from the solutions. 544 545 PyKota's main author is known as 'tamere' on IRC. 498 546 499 547 ============================================================ -
pykota/trunk/setup.py
r1595 r1600 24 24 # 25 25 # $Log$ 26 # Revision 1.47 2004/07/16 12:22:45 jalet 27 # LPRng support early version 28 # 26 29 # Revision 1.46 2004/07/07 13:21:26 jalet 27 30 # Introduction of the pykosd command … … 453 456 454 457 directory = os.sep.join(["share", "pykota"]) 455 data_files.append((directory, ["bin/cupspykota", "bin/ waitprinter.sh", "bin/papwaitprinter.sh", "bin/mailandpopup.sh", "contributed/pagecount.pl", "untested/pjl/pagecount.pjl", "untested/pjl/status.pjl", "untested/netatalk/netatalk.sh", "untested/netatalk/pagecount.ps"]))458 data_files.append((directory, ["bin/cupspykota", "bin/lprngpykota", "bin/waitprinter.sh", "bin/papwaitprinter.sh", "bin/mailandpopup.sh", "contributed/pagecount.pl", "untested/pjl/pagecount.pjl", "untested/pjl/status.pjl", "untested/netatalk/netatalk.sh", "untested/netatalk/pagecount.ps"])) 456 459 457 460 setup(name = "pykota", version = __version__,