Hi. Thank you for your reply.
I already use ifhp but I didn't know it could help me with quota. (I read whole LPRng-Reference
and some chapters of LPRng-Cookbook)
So if you can tell me more about your solution, I would be very grateful !
Here is my whole printcap entry if it could help:
The last 2 commented ifhp lines are just tests I've done, but I didn't really understood what it is suppose to do... Maybe the answer is in :ifhp=pagecount
lp: :sd=/var/spool/lpd/%P :force_localhost :lp=10.23.1.58%9100 # :lp=/dev/null :ifhp=model=hp2200 # :ifhp=pagecount=|/home/paul/p.py # :ifhp=pagecounter,status,dev=10.23.1.58%9100 :filter=/usr/libexec/filters/ifhp :af=|/tmp/p.py :as=|/usr/local/quotaimp/quotaimp.py --start :ae=|/usr/local/quotaimp/quotaimp.py --stop
Thank you for your help !
Paul
From: "Jamie Jennings" <[EMAIL PROTECTED]> Reply-To: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: LPRng: I'm lost with accounting... Date: Fri, 16 Jan 2004 07:48:04 -0330 (NST)
Hi. I don't have a solution to you exact question, however I do printer accounting (like you want) using ifhp. Ifhp will call a accounting script/program and pass the appropriate filestart/fileend line(s) at the start and end of job.
You might want to give it a try. It'll save you your problems with grep'ing.
Let me know if you need any more info.
>
> Hi list,
>
> I am trying to write a python script to manage quota by user with lprng.
>
> So I add it to my printcap:
>
> :af=/tmp/acct
> :as=|/usr/local/quotaimp/quotaimp.py --start
> :ae=|/usr/local/quotaimp/quotaimp.py --stop
>
> The --stop option execute some quite simple commands:
> it looks at the -n(login) -P(printer) -A(info) options passed through the
> command line by LPRng and I check in my accounting file for lines matching
> these options with:
>
> cat /tmp/acct | grep (login) | grep (printer) | grep (info)
>
> Then most of the time, I obtain 2 lines: one beginning with 'filestart'
> and
> the other one beginning with 'fileend'.
> After, I check the -p(pagecounter) option and get how many pages had been
> printed.
>
> Unfortunately, while my tests, I noticed that sometimes, I don't obtain
> only
> 2 lines.
> For example:
>
> # cat /tmp/acct | grep paul | grep lp | grep [EMAIL PROTECTED]
> filestart '-q26339' '-p0' '-t2004-01-15-09:23:01.728' '[EMAIL PROTECTED]'
> '-npaul' '-Plp'
> fileend '-b0' '-T0' '-q26339' '-p0' '-t2004-01-15-09:23:01.730'
> '[EMAIL PROTECTED]' '-npaul' '-Plp'
> filestart '-q30340' '-p471' '-t2004-01-15-18:12:46.904' '[EMAIL PROTECTED]'
> '-npaul' '-Plp'
> fileend '-b4' '-T26' '-q30340' '-p475' '-t2004-01-15-18:13:11.942'
> '[EMAIL PROTECTED]' '-npaul' '-Plp'
>
> I was first surprised because I used to think the '-A' option was unique.
> So is it normal to get 4 lines with this kind of command ?
>
> And do you know how could I do to don't have this kind of problem ?
> I know there is a perl script coming with the LPRng distribution but I
> don't
> understand it and I even don't know if it does what I want.
>
> Any help would be appreciated.
>
> Thanks and sorry for my bad english.
>
> Paul
_________________________________________________________________
Hotmail : un compte GRATUIT qui vous suit partout et tout le temps ! http://g.msn.fr/FR1000/9493
----------------------------------------------------------------------------- YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LIST The address you post from MUST be your subscription address
If you need help, send email to [EMAIL PROTECTED] (or lprng-requests or lprng-digest-requests) with the word 'help' in the body. For the impatient, to subscribe to a list with name LIST, send mail to [EMAIL PROTECTED] with: | example: subscribe LIST <mailaddr> | subscribe lprng-digest [EMAIL PROTECTED] unsubscribe LIST <mailaddr> | unsubscribe lprng [EMAIL PROTECTED]
If you have major problems, send email to [EMAIL PROTECTED] with the word LPRNGLIST in the SUBJECT line. -----------------------------------------------------------------------------
