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 > > _________________________________________________________________ > Trouvez l'�me soeur sur MSN Rencontres http://g.msn.fr/FR1000/9551 > > > ----------------------------------------------------------------------------- > 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. > ----------------------------------------------------------------------------- > ----------------------------------------------------------------------------- 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. -----------------------------------------------------------------------------
