Re: LPRng: user quota mess up..

2003-12-18 Thread James.Q.L

hi. Patrick.
i found the error. it's my stupid mistake. 

i accidentially put the update quota partinto thetheplace extracting state out of stack.to be specifi, i put it into the if(/^START/).

once i put it at the right place -- i.e the end of the accounting.pl file. everything is smooth. 

oh, do you happen to know why sometimesi got negative counter. 
something like this :

END 't=121' 'p=-358045' 's=358045' 'q=0' 'D=1071766321' '[EMAIL PROTECTED]' 'P=printer4' 'n=kadir' 'H=130.63.230.132' 'S=1071766200'
some of the logs can be looked at here. http://dev.econ.yorku.ca/printer/index.pl?printer=printer4
it's still in development. but i am happy to see what i got right now.



Qiang.

Patrick Powell [EMAIL PROTECTED] wrote:
 From [EMAIL PROTECTED] Mon Dec 15 11:20:00 2003 Date: Mon, 15 Dec 2003 13:36:27 -0500 (EST) From: "James.Q.L" <[EMAIL PROTECTED]> Subject: LPRng: user quota mess up.. To: [EMAIL PROTECTED] --0-141834807-1071513387=:20108 Content-Type: text/plain; charset=us-ascii Hi,  In the accounting process, i notice that one user quota being assigned to another user. i am using the accounting.pl that comes with LPRng with some change.   as acct shows, there are two jobs logs and they are mixed up together. i.e the job from alexeev shows up before user 'smiles' finish his job. later user 'smiles' finish his job first.  i think that causes my problem. because in the accounting.pl, i assume i am dealing with one user at a time and get their quota, printed pages then !
 update
 the quota database. now when two jobs mixed up, i may end up updating one user quota for another ..   following is the acct log and the part i do accounting in the accounting.pl. can you give me some suggestion as i am not sure how do i deal with this case..  START '[EMAIL PROTECTED]' 'P=printer4' 'n=smiles' 'H=130.63.230.132' 'D=1071447451' filestart '-q20472' '-p356696' '-t2003-12-14-19:17:32.373' '[EMAIL PROTECTED]' '-nsmiles' '-Pprinter4' START '[EMAIL PROTECTED]' 'P=printer4' 'n=alexeev' 'H=130.63.230.132' 'D=1071468880' filestart '-q21170' '-p356749' '-t2003-12-15-01:14:41.893' '[EMAIL PROTECTED]' '-nalexeev' '-Pprinter4' fileend '-b4' '-T54' '-q21170' '-p356753' '-t2003-12-15-01:15:34.576' '[EMAIL PROTECTED]' '-nalexeev' '-Pprinter4' END 't=21429' 'p=53' 's=356696' 'q=356749' 'D=1071468880' '[EMAIL PROTECTED]' 'P=printer4' 'n=smiles' 'H=130.63.230.132' 'S=1071447451' END 't=55'!
  'p=4'
 's=356749' 'q=356753' 'D=1071468935' '[EMAIL PROTECTED]' 'P=printer4' 'n=alexeev' 'H=130.63.230.132' 'S=1071468880'This is totally baffling me.The START/filestart/fileend/END sequence is generated by a single process,and it should exit and CLOSE the connection to the accounting fileBEFORE another process starts.The only other possible cause might be if you are doing banner pages,but in this case the user names would be the same.Has anybody else seen this?Patrick Powell Astart Technologies[EMAIL PROTECTED] 6741 Convoy CourtNetwork and System San Diego, CA 92111Consulting 858-874-6543 FAX 858-751-2435LPRng - Print Spooler (http://www.lprng.com)-YOU MUST BE A LIST MEMBER IN ORDER TO POST TO THE LPRNG MAILING LISTThe address you post from MUST be your subscription addressIf you need help, send emai!
 l to
 [EMAIL PROTECTED] (or lprng-requestsor 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 | subscribe lprng-digest [EMAIL PROTECTED]unsubscribe LIST | unsubscribe lprng [EMAIL PROTECTED]If you have major problems, send email to [EMAIL PROTECTED] with the wordLPRNGLIST in the SUBJECT line.-Post your free ad now! Yahoo! Canada Personals

Re: LPRng: user quota mess up..

2003-12-17 Thread Patrick Powell
 From [EMAIL PROTECTED] Mon Dec 15 11:20:00 2003
 Date: Mon, 15 Dec 2003 13:36:27 -0500 (EST)
 From: James.Q.L [EMAIL PROTECTED]
 Subject: LPRng: user quota mess up..
 To: [EMAIL PROTECTED]

 --0-141834807-1071513387=:20108
 Content-Type: text/plain; charset=us-ascii

 Hi,
  
 In the accounting process, i notice that one user quota being assigned to another 
 user.  i am using the accounting.pl that comes with LPRng with some change. 
  
 as acct shows, there are two jobs logs and they are mixed up together.
 i.e the job from alexeev shows up before user 'smiles' finish his job. later  user 
 'smiles' finish his job first.  
 i think that causes my problem. because in the accounting.pl, i assume i am dealing 
 with one user at a time and get their quota, printed pages then update the quota 
 database. now when two jobs mixed up, i may end up updating one user quota for 
 another .. 
  
 following is the acct log and the part i do accounting in the accounting.pl.
 can you give me some suggestion as i am not sure how do i deal with this case..
  
 START '[EMAIL PROTECTED]' 'P=printer4' 'n=smiles' 'H=130.63.230.132' 'D=1071447451'
 filestart '-q20472' '-p356696' '-t2003-12-14-19:17:32.373' '[EMAIL PROTECTED]' 
 '-nsmiles' '-Pprinter4'
 START '[EMAIL PROTECTED]' 'P=printer4' 'n=alexeev' 'H=130.63.230.132' 'D=1071468880'
 filestart '-q21170' '-p356749' '-t2003-12-15-01:14:41.893' '[EMAIL PROTECTED]' 
 '-nalexeev' '-Pprinter4'
 fileend '-b4' '-T54' '-q21170' '-p356753' '-t2003-12-15-01:15:34.576' '[EMAIL 
 PROTECTED]' '-nalexeev' '-Pprinter4'
 END 't=21429' 'p=53' 's=356696' 'q=356749' 'D=1071468880' '[EMAIL PROTECTED]' 
 'P=printer4' 'n=smiles' 'H=130.63.230.132' 'S=1071447451'
 END 't=55' 'p=4' 's=356749' 'q=356753' 'D=1071468935' '[EMAIL PROTECTED]' 
 'P=printer4' 'n=alexeev' 'H=130.63.230.132' 'S=1071468880'


This is totally baffling me.

The START/filestart/fileend/END sequence is generated by a single process,
and it should exit and CLOSE the connection to the accounting file
BEFORE another process starts.

The only other possible cause might be if you are doing banner pages,
but in this case the user names would be the same.

Has anybody else seen this?


Patrick Powell Astart Technologies
[EMAIL PROTECTED]6741 Convoy Court
Network and System San Diego, CA 92111
  Consulting   858-874-6543 FAX 858-751-2435
LPRng - Print Spooler (http://www.lprng.com)

-
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.
-


LPRng: user quota mess up..

2003-12-15 Thread James.Q.L
Hi,

In the accounting process, i notice that one user quota being assigned to another user. i am using the accounting.pl that comes with LPRng with some change. 

as acct shows, there are two jobs logs and they are mixed up together.
i.e the job from alexeev shows up before user 'smiles' finish his job.later user 'smiles' finish his job first.
i think that causes my problem. because inthe accounting.pl, i assume i am dealing with one user at a time and get their quota,printed pages then update the quota database. now when two jobs mixed up, i may end up updating one user quota for another .. 

following is the acct log and the part i do accounting in the accounting.pl.
can you give me some suggestion as i am not sure how do i deal with this case..

START '[EMAIL PROTECTED]' 'P=printer4' 'n=smiles' 'H=130.63.230.132' 'D=1071447451'filestart '-q20472' '-p356696' '-t2003-12-14-19:17:32.373' '[EMAIL PROTECTED]' '-nsmiles' '-Pprinter4'START '[EMAIL PROTECTED]' 'P=printer4' 'n=alexeev' 'H=130.63.230.132' 'D=1071468880'filestart '-q21170' '-p356749' '-t2003-12-15-01:14:41.893' '[EMAIL PROTECTED]' '-nalexeev' '-Pprinter4'fileend '-b4' '-T54' '-q21170' '-p356753' '-t2003-12-15-01:15:34.576' '[EMAIL PROTECTED]' '-nalexeev' '-Pprinter4'END 't=21429' 'p=53' 's=356696' 'q=356749' 'D=1071468880' '[EMAIL PROTECTED]' 'P=printer4' 'n=smiles' 'H=130.63.230.132' 'S=1071447451'END 't=55' 'p=4' 's=356749' 'q=356753' 'D=1071468935' '[EMAIL PROTECTED]' 'P=printer4' 'n=alexeev' 'H=130.63.230.132' 'S=1071468880'

here is what i have in the accounting.pl .
the part after ## update db ## is my change. 

for( my $i = @stack -1; $i = 0 ; --$i ){ $_ = $stack[$i]; print STDERR "stack [$i] '$_'\n" if $debug; if( /^[a-z]*end .*-p(\d+)/ ){ $end_counter = $1; } elsif( /^[a-z]*start .*-p(\d+)/ ){ $start_counter = $1; } elsif( /^START/ ){ # we now update the accounting information ($start_time) = /D=(\d+)/; s/D=(\d+)/S=$1/; $count = $end_counter - $start_counter; $elapsed = $time - $start_time; # you should put your make update record stuff here s/^START/END
 't=$elapsed' 'p=$count' 's=$start_counter' 'q=$end_counter' 'D=$time'/; $out = $_ . "\n" . $out; $end_counter = $start_counter; $time = $start_time;
 handle_error("Printing Halted.") if ($count=~/-/);
 ###@@ ## update db ###@@ connect_db(); $pages = check_page_count(); $remain = $pages-$count; ## inform user s/he has no print quota left. unless ($remain)
 { my $msg = "Your Print Quota is 0 now"; `$rmssh $uname $msg`; } update_db($remain); ## @@ write job.history write_history(''); $dbh-disconnect() if $dbh; }}

Post your free ad now! Yahoo! Canada Personals