RE: is possible start some actions with Perl without Cron?

2004-08-20 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Maxipoint Rep Office wrote:
> Have you some useful URL about that?
> 
Not really. You should look at CPAN for daemon or background processing. Then 
you just need to understand the Perl necessary to get what you want done. Obviously 
easier said than done, but layout what you want to do, then attmept to do a portion of 
it. Run into problems, then show the snippet of code to the list and usually someone 
will be able to give some help.

Wags ;)
> -Original Message-
> From: Wagner, David --- Senior Programmer Analyst --- WGO
> [mailto:[EMAIL PROTECTED]
> Sent: Saturday, August 21, 2004 1:07 AM
> To: Maxipoint Rep Office; [EMAIL PROTECTED]
> Subject: RE: is possible start some actions with Perl without Cron?
> 
> 
> Maxipoint Rep Office wrote:
>> is possible start some actions with Perl without Cron?
>> 
>> for example send email to users from database after 3 days or delete
>> something from database automaticaly after 3 day with Perl but
>> without Cron?
>   Yes. You would write the Perl as a daemon and have it run in
> background. Have it work and sleep as you desire it to.
> 
> Wags ;)
> 
> 
> ***
> This message contains information that is confidential
> and proprietary to FedEx Freight or its affiliates.
> It is intended only for the recipient named and for
> the express purpose(s) described therein.
> Any other use is prohibited.
> ***


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: is possible start some actions with Perl without Cron?

2004-08-20 Thread Maxipoint Rep Office

Have you some useful URL about that?

-Original Message-
From: Wagner, David --- Senior Programmer Analyst --- WGO
[mailto:[EMAIL PROTECTED]
Sent: Saturday, August 21, 2004 1:07 AM
To: Maxipoint Rep Office; [EMAIL PROTECTED]
Subject: RE: is possible start some actions with Perl without Cron?


Maxipoint Rep Office wrote:
> is possible start some actions with Perl without Cron?
>
> for example send email to users from database after 3 days or delete
> something from database automaticaly after 3 day with Perl but
> without Cron?
Yes. You would write the Perl as a daemon and have it run in background.
Have it work and sleep as you desire it to.

Wags ;)


***
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
***



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: is possible start some actions with Perl without Cron?

2004-08-20 Thread Wagner, David --- Senior Programmer Analyst --- WGO
Maxipoint Rep Office wrote:
> is possible start some actions with Perl without Cron?
> 
> for example send email to users from database after 3 days or delete
> something from database automaticaly after 3 day with Perl but
> without Cron? 
Yes. You would write the Perl as a daemon and have it run in background. Have 
it work and sleep as you desire it to.

Wags ;)


***
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
***


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: is possible start some actions with Perl without Cron?

2004-08-20 Thread Gunnar Hjalmarsson
Maxipoint Rep Office wrote (also to comp.lang.perl.misc):
is possible start some actions with Perl without Cron?
Do not multi-post!
http://www.uwasa.fi/~ts/http/crospost.html
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



is possible start some actions with Perl without Cron?

2004-08-20 Thread Maxipoint Rep Office
is possible start some actions with Perl without Cron?

for example send email to users from database after 3 days or delete
something from database automaticaly after 3 day with Perl but without Cron?

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Getting info from website search.

2004-08-20 Thread perlwannabe
OK, I know my subject is not the best, but I couldn't think of anything
better.  Here is my situation:

There is a website that allows you to search a database by Name or Number.
 Once you search by name it will provide all kinds of information
(including dates) for the search parameters.  I want to be able to search
by date, which is not one of the options.

Here is the site:

http://207.156.115.73/patraffic/startsearch.aspx

If you select "Search by Name" it gives you input for a name and both a
start and end date.  I would like to use a wildcard in the name to give me
every person that received a ticket on July 23, 2004.  Any ideas on how to
formulate this in a command line?


I want to be able to find a way to pull all of the tickets issued on a
specific date (i.e. all tickets issued on 8/02/2004) Right now, the search
is useless to me because a date search is not an option eventhough the
date is available in the database.





-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: multiplexing Net::DNS::Nameserver

2004-08-20 Thread Chris Devers
On Fri, 20 Aug 2004, Jeremy Kister wrote:
Is there a more advanced Perl list than perl-beginners, where someone 
may have hints?

I've browsed lists.perl.org but found nothing appropriate.
There's no "perl-intermediate" that I know of, if that's what you mean.
More often, I'd assume people start looking for lists specific to the 
work they're doing once they've "graduated" from the beginners lists, 
e.g. web programmers might move from beginners-cgi to mod_perl, or to 
the list[s] related to modules they're using a lot.

--
Chris Devers  [EMAIL PROTECTED]
http://devers.homeip.net:8080/blog/
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



Re: multiplexing Net::DNS::Nameserver

2004-08-20 Thread Jeremy Kister
On Friday, August 20, 2004 3:50 PM, Wiggins d Anconia wrote:
> confused about or are attempting to do.  IO::Multiplex works at a
> lowlevel on filehandles, specifically sockets. Net::DNS::Nameserver is
> designed to be a high-level all inclusive server, aka you don't really
> have access to the sockets it is using.

That's exactly why I was posting -- I was hoping someone had a different
answer :)

I shouldnt have limited my query to IO::Multiplex, rather any solution for a
non-blocking solution for Net::DNS::Nameserver.

> So take two steps back, tell us what you are really doing... then take
> one step back and tell us why you chose these two modules, and how you
> are thinking they should fit together, and whether you are open to other
> suggestions.

the example at
http://search.cpan.org/~crein/Net-DNS-0.48/lib/Net/DNS/Nameserver.pm (and
any other variation) can only handle a single query at a time.  I simply
want to create a server using Net::DNS::Nameserver that can handle multiple
requests, concurrently.

I do want to keep Net::DNS::Nameserver as the server, but am open to all
suggestions on how to make it non-blocking.  My experience with
IO::Multiplex has been positive, and thought they could solve the problem
together, if they could talk to each other.  I should add that I'm not
interested in forking off processes to handle concurrency, though; that'd be
way too slow and dirty.

> This is where I will make a preliminary gamble (or maybe a "blind" bet)
> and say POE can do it :-)

I'm looking at it now...  thanks again.

Jeremy Kister
http://jeremy.kister.net/




-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: multiplexing Net::DNS::Nameserver

2004-08-20 Thread Bob Showalter
Jeremy Kister wrote:
> On Wednesday, August 18, 2004 5:56 PM, I wrote:
> > can anyone give me a clue as to how to use IO::Multiplex on top of
> > Net::DNS::Nameserver?
> 
> Is there a more advanced Perl list than perl-beginners, where someone
> may have hints?

perlmonks is good, as Wiggins said.

>From a quick perusal of the two modules, I'd say it would be quite difficult
to do, because of the differences between the way the two work. You'd have
to restructure Net::DNS::Nameserver quite a bit, since it wants to handle
the listen, accept, and read/recv processes itself, and the activity is
distributed throughout the various methods, with sockets being passed
around. IO::Multiplex wants to hide all that from you and just pass data
around.

If you want to go through the trouble, you should try to work with the
Net::DNS::Nameserver to merge your changes back in to improve the module.

Just my $0.02

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: multiplexing Net::DNS::Nameserver

2004-08-20 Thread Wiggins d Anconia
> On Wednesday, August 18, 2004 5:56 PM, I wrote:
> > can anyone give me a clue as to how to use IO::Multiplex on top of
> > Net::DNS::Nameserver?
> 
> Is there a more advanced Perl list than perl-beginners, where someone may
> have hints?
> 

You could try perlmonks.org...

> I've browsed lists.perl.org but found nothing appropriate.
> 

I saw your question, was thinking someone might have an answer and let
it sit. 

My question is what do you really mean?  Your question is rather vague,
and I don't understand from the little you have posted what you are
confused about or are attempting to do.  IO::Multiplex works at a
lowlevel on filehandles, specifically sockets. Net::DNS::Nameserver is
designed to be a high-level all inclusive server, aka you don't really
have access to the sockets it is using.

So take two steps back, tell us what you are really doing... then take
one step back and tell us why you chose these two modules, and how you
are thinking they should fit together, and whether you are open to other
suggestions.

This is where I will make a preliminary gamble (or maybe a "blind" bet)
and say POE can do it :-)

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: multiplexing Net::DNS::Nameserver

2004-08-20 Thread Jeremy Kister
On Wednesday, August 18, 2004 5:56 PM, I wrote:
> can anyone give me a clue as to how to use IO::Multiplex on top of
> Net::DNS::Nameserver?

Is there a more advanced Perl list than perl-beginners, where someone may
have hints?

I've browsed lists.perl.org but found nothing appropriate.

Jeremy Kister
http://jeremy.kister.net/


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Problems with a socket script

2004-08-20 Thread Jeff 'japhy' Pinyan
On Aug 20, Dave Kettmann said:

>What I am wanting to do, is from a webpage, run a tail command on another
>machine to read x amount of lines from a log file and print it on a web
>page.

Ok.  Then what you do is you set up a listening socket on the server with
the log file:

  use IO::Socket;
  my $server = IO::Socket::INET->new(
LocalAddr => 'this.machine.com',
LocalPort => '9090',
Reuse => 1,
Listen => 10,
  ) or die "can't create $server: $!";

You make this listening socket accept a connection and print the results
of the command back to the client:

  while (my $client = $server->accept) {
print $client `/usr/bin/tail -75 some_file`;
  }

Voila, you're done.  The thing is, that program needs to be running
constantly, because it has to listen for an incoming connection.

To connect to it, you would write this in your CGI program:

  use IO::Socket;

  my $log_socket = IO::Socket::INET->new(
RemoteAddr => 'that.machine.com',
RemotePort => '9090',
  ) or die "can't create socket: $!";

That connects you to the listening server.  Then you just print what's
waiting on the socket:

  print <$log_socket>;

And then you're done.  When the server's done sending you data, it closes
the connection, so your socket is closed.

>Another question is, what is wrong with IO::Socket?? I am still very new
>at perl and would appreciate input on the pros/cons of using Socket as
>opposed to using IO::Socket.

You misread me:

>>while (($new_sock, $c_addr) = $sock->accept())
>>{
>> my ($client_port, $c_ip) =sockaddr_in($c_addr);
>> my $client_ipnum = inet_ntoa($c_ip);
>> my $client_host =gethostbyaddr($c_ip, AF_INET);
>
>Eww.  You're using IO::Socket, so *use* it:

What I meant was that you're using the IO::Socket module, but instead of
using its easy and convenient object methods, you're using the klunky and
awkward Socket module's functions.

IO::Socket is easier to use, but does the same thing as Socket.  I always
use IO::Socket because I'm more comfortable and it's easier to understand
what I'm doing.

-- 
Jeff "japhy" Pinyan %  How can we ever be the sold short or
RPI Acacia Brother #734 %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %-- Meister Eckhart


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: cgi modules

2004-08-20 Thread Wiggins d Anconia
> 
> All, 
> I want to use a web interface for certain functions such as displaying 
> process results and data from programs.  What module should I use?  I 
> noticed CGI::Safe, CGI::Base,  and CGI that stood out to me???

Note that there is a [EMAIL PROTECTED] list as well.

CGI::Safe is really just a wrapper on CGI, so if you are using CGI::Safe
then you are using CGI. Check the docs for CGI::Safe to see if it
provides conveniences that you would like, they are pretty simple,
straightforward, and handy.

CGI::Base is intended to be fairly low-level, and you are not likely to
be using it if you are simply planning on writing some cgi scripts, note
from the docs the following:

"Note that CGI application developers will generally deal with the
CGI::Request class and not directly with the CGI::Base class."

This is partially because it does not handle query string parsing which
you will want.

I would stick with CGI.pm, and optionally CGI::Safe.

http://danconia.org

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Problems with a socket script

2004-08-20 Thread Dave Kettmann
Ok, so I guess first off, I was confused about sockets. Maybe I need to start over and 
rethink how to do this.

What I am wanting to do, is from a webpage, run a tail command on another machine to 
read x amount of lines from a log file and print it on a web page. I thought the 
'best' way would be a socket, but it turns out that the client cannot recieve data 
from the server, if I am understanding this correctly.

Another question is, what is wrong with IO::Socket?? I am still very new at perl and 
would appreciate input on the pros/cons of using Socket as opposed to using 
IO::Socket. (I hope this doesnt turn into a 'pico is better than vi'-type argument 
:-D) Anyways, any input at all is appreciated. I'm going to start looking into other 
way to accomplish this task.

Dave Kettmann
NetLogic
636-561-0680

-Original Message-
From: Jeff 'japhy' Pinyan [mailto:[EMAIL PROTECTED]
Sent: Friday, August 20, 2004 10:49 AM
To: Dave Kettmann
Cc: Perl List (E-mail)
Subject: Re: Problems with a socket script


On Aug 20, Dave Kettmann said:

>I am writing a socket script so I can pull a log file thru a web page.
>For right now, Im just trying to get it to work from a shell. I have
>gotten it to where the client sends information to the server, but this
>should work the other way. When I try to get the server to write to the
>client, I get a broken pipe error. Below is the code for the server
>program:

It looks like you have something backwards...

>my $sock = new IO::Socket::INET(
>LocalHost => 'druidia.netlogic.net',
>LocalPort => 7890,
>Proto => 'tcp',
>Listen=> SOMAXCONN,
>Reuse => 1);

THIS is your LISTENING socket.  It makes no sense for YOU to print to it,
like you do later.

>$sock or die "no socket :$!";
>my($new_sock, $c_addr, $buf);
>
>while (($new_sock, $c_addr) = $sock->accept())
>{
> my ($client_port, $c_ip) =sockaddr_in($c_addr);
> my $client_ipnum = inet_ntoa($c_ip);
> my $client_host =gethostbyaddr($c_ip, AF_INET);

Eww.  You're using IO::Socket, so *use* it:

  while (my $client = $sock->accept) {
my ($port, $host) = ($client->peerport, $client->peerhost);
# do whatever logging you want with those values...
print $client tail(-75, "/var/log/radius.log");
close $client;  # not strictly necessary, due to scoping
  }

-- 
Jeff "japhy" Pinyan %  How can we ever be the sold short or
RPI Acacia Brother #734 %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %-- Meister Eckhart


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Problems with a socket script

2004-08-20 Thread Jeff 'japhy' Pinyan
On Aug 20, Dave Kettmann said:

>I am writing a socket script so I can pull a log file thru a web page.
>For right now, Im just trying to get it to work from a shell. I have
>gotten it to where the client sends information to the server, but this
>should work the other way. When I try to get the server to write to the
>client, I get a broken pipe error. Below is the code for the server
>program:

It looks like you have something backwards...

>my $sock = new IO::Socket::INET(
>LocalHost => 'druidia.netlogic.net',
>LocalPort => 7890,
>Proto => 'tcp',
>Listen=> SOMAXCONN,
>Reuse => 1);

THIS is your LISTENING socket.  It makes no sense for YOU to print to it,
like you do later.

>$sock or die "no socket :$!";
>my($new_sock, $c_addr, $buf);
>
>while (($new_sock, $c_addr) = $sock->accept())
>{
> my ($client_port, $c_ip) =sockaddr_in($c_addr);
> my $client_ipnum = inet_ntoa($c_ip);
> my $client_host =gethostbyaddr($c_ip, AF_INET);

Eww.  You're using IO::Socket, so *use* it:

  while (my $client = $sock->accept) {
my ($port, $host) = ($client->peerport, $client->peerhost);
# do whatever logging you want with those values...
print $client tail(-75, "/var/log/radius.log");
close $client;  # not strictly necessary, due to scoping
  }

-- 
Jeff "japhy" Pinyan %  How can we ever be the sold short or
RPI Acacia Brother #734 %  the cheated, we who for every service
http://japhy.perlmonk.org/  %  have long ago been overpaid?
http://www.perlmonks.org/   %-- Meister Eckhart


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Problems with a socket script

2004-08-20 Thread Dave Kettmann
Hi all,

I am writing a socket script so I can pull a log file thru a web page. For right now, 
Im just trying to get it to work from a shell. I have gotten it to where the client 
sends information to the server, but this should work the other way. When I try to get 
the server to write to the client, I get a broken pipe error. Below is the code for 
the server program:

#!/usr/bin/perl -w
# serIO.pl
# server using IO::Socket
#

use strict;
use IO::Socket;
use Shell qw(tail);

my $sock = new IO::Socket::INET(
LocalHost => 'druidia.netlogic.net',
LocalPort => 7890,
Proto => 'tcp',
Listen=> SOMAXCONN,
Reuse => 1);


$sock or die "no socket :$!";
my($new_sock, $c_addr, $buf);

while (($new_sock, $c_addr) = $sock->accept())
{
 my ($client_port, $c_ip) =sockaddr_in($c_addr);
 my $client_ipnum = inet_ntoa($c_ip);
 my $client_host =gethostbyaddr($c_ip, AF_INET);

# This is what it will do eventually
# print $sock tail("-75 /var/log/radius.log");

# Just for testing purposes
print $sock "TEST";

 while (defined ($buf = <$new_sock>))
 {
  print $buf;
 }
}

Any help is appreciated, I have tried debugging it, and it 'dies' at the 'print $sock 
"TEST";' line. I am still learning perl, and copied most of this from various 
tutorials on sockets. 

TIA,

Dave Kettmann
NetLogic
636-561-0680

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Processing Qmail Smtp session Log

2004-08-20 Thread Gunnar Hjalmarsson
BadApple wrote:
Hi Group ,
You posted the same problem to comp.lang.perl.misc. Doing so is called 
multi-posting, and is considered rude:

http://www.uwasa.fi/~ts/http/crospost.html
I just posted a reply to comp.lang.perl.misc, and I'd suggest that 
possible follow-ups are posted only there.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



RE: Pls Help with a Basic Script.

2004-08-20 Thread Jenda Krynicky
From: "Denham Eva" <[EMAIL PROTECTED]>
> Are you just trying to report the ORA-XXX errors in reverse order? If
> so, something like this should work:
> 
> my @errs;
> while () {
> push @errs, $_ if /ORA-/;
> }
> print reverse @errs;

I wanted to ask why do you push the lines at the end and then reverse 
the array?

 my @errs;
 while () {
 unshift @errs, $_ if /ORA-/;
 }
 print @errs;

But Benchmark says your way is actually quicker :-)

#!perl
use Benchmark;

sub pushReverse {
my @arr;
for (1..1) {
push @arr, $_;
}
my @b = reverse @arr;
}

sub withUnshift {
my @arr;
for (1..1) {
unshift @arr, $_;
}
my @b = @arr;
}

timethese 1, {
pushReverse => \&pushReverse,
withUnshift => \&withUnshift,
}
__END__
Benchmark: timing 1 iterations of pushReverse, withUnshift...
pushReverse: 80 wallclock secs (78.39 usr +  0.05 sys = 78.44 CPU) 
@ 127.49/s (n=1)
withUnshift: 85 wallclock secs (83.84 usr +  0.09 sys = 83.94 CPU) 
@ 119.14/s (n=1)

Jenda
= [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
-- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Processing Qmail Smtp session Log

2004-08-20 Thread BadApple
Hi Group ,

I am trying to process a Qmail Smtp session Log file ( multilog ).

The section of the Log file is give below :

@40004123d44320c51f3c tcpserver: ok 9198
mailgateway.foo.com:10.10.0.1:25 :20.132.29.1::60433
@40004123d44320c52edc qmail-smtpd 9198: connection from 200.12.239.1
(unknown) to mailgateway.foo.com
@40004123d4451529c72c qmail-smtpd 9198: authentication success, user
Authenticated user:[EMAIL PROTECTED]
@40004123d4452fcdffbc qmail-smtpd 9198: mail from: [EMAIL PROTECTED]
@40004123d4460f3cbbe4 qmail-smtpd 9198: rcpt to: [EMAIL PROTECTED]
@40004123d452240346c4 tcpserver: status: 4/150
@40004123d455142c5844 qmail-smtpd 9198: message queued: 1092867147 qp
9200 size 84902 bytes
@40004123d455341b60dc tcpserver: end 9198 status 0

For every user that authenticates a "Authenticated user:" line is generated
also a "pid" is assigned to this session .The pid is the number visible
after the "qmail-smtpd" field in this case it's "9198".After the message is
transferred the line " message queued " is generated and the no of bytes
transferred is printed just before the "bytes" field .
The pid assigned is constant till the smtp session is live . The start of
any smtp session is the line "tcpserver: ok  ...ipaddress
..."
The end of the smtp session is marked by the line ."tcpserver: end 
status 0".

I am trying to match this pid for the "Authenticated user:" to the bytes
transferred.

I have written following code ,which works a bit ,but it fails if another
smtp session start before the end of the smtp session which I am processing
.

My Code .
---
#!/usr/bin/perl -w
# The Log File
$logfile = shift || die "Usage:$0 ";
open FLE, "< $logfile" if defined ($logfile);
# While Start
while () {
chomp;
# We get the Authenticated Line
if (/\s(\d{1,}): authentication success, user Authenticated
user:(.{1,})$/){ # Start IF AUTHENTICATED
# We assign the Pid and Auth User
$authpid = $1; # Auth pid
$authuser = $2; # Auth User
$HoH{$authpid}{user} = $authuser;  # Just create a Hash for each
Pid
print "Pid: $authpid User: $authuser \n";
}   # END IF AUTHENTICATED
# We search the bytes transferred line
if (/qmail-smtpd\s(\d{1,}):\smessage
queued:\s\d{1,}\sqp\s\d{1,}\ssize\s(\d{1,})\sbytes.*$/){ # IF MESSAGE QUEUED
# We define Pid and Bytes
$pid = $1;
$bytes = $2;
#$HoH{$pid}{Bytes} = $bytes if defined ( $HoH{$pid} );
if (defined ( $HoH{$pid})) {  # Check if it's pid of an
authenticated smtp session ,if not it's mostly a non authenticated session
print "Pid :$pid Bytes :$bytes\n";
}
} # END IF QUEUED

}

---

And the output is :

-
Pid: 10554 User: [EMAIL PROTECTED]
Pid :10554 Bytes :6385
Pid: 11315 User: [EMAIL PROTECTED]
Pid :11315 Bytes :1605
Pid: 11547 User: [EMAIL PROTECTED]
Pid: 11842 User: [EMAIL PROTECTED]
Pid: 11844 User: [EMAIL PROTECTED]
Pid :11844 Bytes :1112
--

As you can see till [EMAIL PROTECTED] I am getting the Username & bytes
properly but later after [EMAIL PROTECTED] the bytes are lost .

My questions are :
1. When I get a pid of Authenticated User how do I store it till the bytes
are found.
2. When I get the bytes how do I destroy the Hash so that the bytes won't
get overwritten
3. When handling more than one "Authenticated user:"  pids how to store them
(pids) till the corresponding "bytes" line is not received .

Thanx in advance for any help
BadApple



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Processing Qmail Smtp Session Log

2004-08-20 Thread Bad Apple
Hi Group ,

I am trying to process a Qmail Smtp session Log file (
multilog ).

The section of the Log file is give below :

@40004123d44320c51f3c tcpserver: ok 9198
mailgateway.foo.com:10.10.0.1:25 :20.132.29.1::60433
@40004123d44320c52edc qmail-smtpd 9198: connection
from 200.12.239.1 (unknown) to mailgateway.foo.com
@40004123d4451529c72c qmail-smtpd 9198:
authentication success, user Authenticated
user:[EMAIL PROTECTED]
@40004123d4452fcdffbc qmail-smtpd 9198: mail from:
[EMAIL PROTECTED]
@40004123d4460f3cbbe4 qmail-smtpd 9198: rcpt to:
[EMAIL PROTECTED]
@40004123d452240346c4 tcpserver: status: 4/150
@40004123d455142c5844 qmail-smtpd 9198: message
queued: 1092867147 qp 9200 size 84902 bytes
@40004123d455341b60dc tcpserver: end 9198 status 0

For every user that authenticates a "Authenticated
user:" line is generated also a "pid" is assigned to
this session .The pid is the number visible after the
"qmail-smtpd" field in this case it's "9198".After the
message is transferred the line " message queued " is
generated and the no of bytes transferred is printed
just before the "bytes" field .
The pid assigned is constant till the smtp session is
live . The start of any smtp session is the line
"tcpserver: ok  ...ipaddress ..."
The end of the smtp session is marked by the line
."tcpserver: end  status 0".

I am trying to match this pid for the "Authenticated
user:" to the bytes transferred.

I have written following code ,which works a bit ,but
it fails if another smtp session start before the end
of the smtp session which I am processing .

My Code .
---
#!/usr/bin/perl -w
# The Log File
$logfile = shift || die "Usage:$0 ";
open FLE, "< $logfile" if defined ($logfile);
# While Start
while () {
chomp;
# We get the Authenticated Line
if (/\s(\d{1,}): authentication success, user
Authenticated user:(.{1,})$/){ # Start IF
AUTHENTICATED
# We assign the Pid and Auth User
$authpid = $1; # Auth pid
$authuser = $2; # Auth User
$HoH{$authpid}{user} = $authuser;  # Just
create a Hash for each Pid 
print "Pid: $authpid User: $authuser \n";
}   # END IF
AUTHENTICATED
# We search the bytes transferred line
if (/qmail-smtpd\s(\d{1,}):\smessage
queued:\s\d{1,}\sqp\s\d{1,}\ssize\s(\d{1,})\sbytes.*$/){
# IF MESSAGE QUEUED
# We define Pid and Bytes
$pid = $1;
$bytes = $2;
#$HoH{$pid}{Bytes} = $bytes if defined (
$HoH{$pid} );
if (defined ( $HoH{$pid})) {  #
Check if it's pid of an authenticated smtp session ,if
not it's mostly a non authenticated session 
print "Pid :$pid Bytes
:$bytes\n";
}
} # END IF QUEUED

}

---

And the output is :

-
Pid: 10554 User: [EMAIL PROTECTED]
Pid :10554 Bytes :6385
Pid: 11315 User: [EMAIL PROTECTED]
Pid :11315 Bytes :1605
Pid: 11547 User: [EMAIL PROTECTED]
Pid: 11842 User: [EMAIL PROTECTED]
Pid: 11844 User: [EMAIL PROTECTED]
Pid :11844 Bytes :1112
--

As you can see till [EMAIL PROTECTED] I am getting the
Username & bytes properly but later after [EMAIL PROTECTED]
the bytes are lost .

My questions are :
1. When I get a pid of Authenticated User how do I
store it till the bytes are found.
2. When I get the bytes how do I destroy the Hash so
that the bytes won't get overwritten
3. When handling more than one "Authenticated user:" 
pids how to store them (pids) till the corresponding
"bytes" line is not received .

Thanx in advance for any help
BadApple


Yahoo! India Matrimony: Find your life partner online
Go to: http://yahoo.shaadi.com/india-matrimony

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Pls Help with a Basic Script.

2004-08-20 Thread Denham Eva
Thanks Bob,
I discovered this when using Mark's suggestion.
[snip]
You haven't read a row from SITELOG. So the regex below is checking the
row
from your SITES file.

> 
> # Check the file for any ORA- entries
> 
> if($_ =~ m/ORA-/) {
> 
> # If it contains records, reverse the file
> 
> my @lines = reverse($_);

The call to reverse() is doing nothing here. You're just assigning the
scalar $_ to the array @lines, which will have one element following the
assignment.

Are you just trying to report the ORA-XXX errors in reverse order? If
so,
something like this should work:

my @errs;
while () {
push @errs, $_ if /ORA-/;
}
print reverse @errs;

Thanks for this, it is neater than my solution!

Regards
Denham

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Pls Help with a Basic Script.

2004-08-20 Thread Denham Eva
a) Thanks Mark for this.
b) Thanks here again, I'll be using this in the future a lot and yes it
is not what I expected, back to the drawing board.

-Original Message-
From: Anderson, Mark (Service Delivery)
[mailto:[EMAIL PROTECTED] 
Sent: Friday, August 20, 2004 12:42 PM
To: Denham Eva; [EMAIL PROTECTED];
[EMAIL PROTECTED]
Subject: RE: Pls Help with a Basic Script.

At the line:  if($_ =~ m/ORA-/ ){ 

a) you don't need the m/ just / 
b) what are you expecting to be in $_ and have you checked (print stderr
"$_";)?


Kind regards,

Mark Anderson
SMS Deployment
The Royal Bank of Scotland
113 Dundas Street, Edinburgh, EH3 5DE
http://www.manufacturing.rbs.co.uk/GTrswi/


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Pls Help with a Basic Script.

2004-08-20 Thread Bob Showalter
Denham Eva wrote:
> Please could the wise folks give me some help. Something is wrong and
> I can not find out what.
> 
> When I run this program it returns everything is OK (Suspect a logic
> error somewhere), which is not possible as the logs in question do
> have data that I require (i.e. ORA-12571: TNS:packet writer failure).
> 
> This script is to check the Oracle Logs for errors beginning with
> "ORA-" i.e. ORA-013100
> 
> Then it should return only the errors. You will see I try to reverse
> the file as I only want the newest errors first, anyway I want to
> build that functionality into it eventually that I can set a
> limit...but that is for later.
> 
> Here is my script.
> 
[snip]
> 
> # open the LogFile
> 
> open SITELOG, "$loc" ||die "Can not open $loc: $!";
>  
> # I suspect that my mistake may be around here :-)

You haven't read a row from SITELOG. So the regex below is checking the row
from your SITES file.

> 
> # Check the file for any ORA- entries
> 
> if($_ =~ m/ORA-/) {
> 
> # If it contains records, reverse the file
> 
> my @lines = reverse($_);

The call to reverse() is doing nothing here. You're just assigning the
scalar $_ to the array @lines, which will have one element following the
assignment.

Are you just trying to report the ORA-XXX errors in reverse order? If so,
something like this should work:

my @errs;
while () {
push @errs, $_ if /ORA-/;
}
print reverse @errs;

HTH

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




RE: Pls Help with a Basic Script.

2004-08-20 Thread Anderson, Mark (Service Delivery)
At the line:  if($_ =~ m/ORA-/ ){ 

a) you don't need the m/ just / 
b) what are you expecting to be in $_ and have you checked (print stderr
"$_";)?


Kind regards,

Mark Anderson
SMS Deployment
The Royal Bank of Scotland
113 Dundas Street, Edinburgh, EH3 5DE
http://www.manufacturing.rbs.co.uk/GTrswi/


> -Original Message-
> From: Denham Eva [SMTP:[EMAIL PROTECTED]
> Sent: Friday, August 20, 2004 11:30 AM
> To:   [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject:  Pls Help with a Basic Script.
> 
> *** WARNING : This message originates from the Internet ***
> 
> 
> 
> Please could the wise folks give me some help. Something is wrong and I
> can not find out what.
> 
> When I run this program it returns everything is OK (Suspect a logic error
> somewhere), which is not possible as the logs in question do have data
> that I require (i.e. ORA-12571: TNS:packet writer failure).
> 
> This script is to check the Oracle Logs for errors beginning with "ORA-"
> i.e. ORA-013100
> 
> Then it should return only the errors. You will see I try to reverse the
> file as I only want the newest errors first, anyway I want to build that
> functionality into it eventually that I can set a limit...but that is for
> later.
> 
> Here is my script.
> 
>  
> 
> ** SNIP ***
> 
>  
> 
> #!/usr/bin/perl -w
> 
> use strict;
> 
> use warnings;
> 
> # use POSIX 'strftime';
> 
> # For later functionality.
> 
> # my $day = (strftime('%w', localtime()) - 1);
> 
>  
> 
> # Save all the sites to be checked in a text file
> 
> # Example line:-
> 
> # OrcaleSid:://windowsserver/share/directory/logfile.log
> 
>  
> 
> open SITES, "c:/denham/dba/sites/alrtlogs.txt" || die "Can not Open
> alrtlogs.txt: $!";
> 
>  
> 
> # Now while through the file and do each site.
> 
> while () {
> 
> (my $sid, my $loc) = split(/::/);
> 
> chomp($sid);
> 
> chomp($loc);
> 
> 
> 
> print "\n";
> 
> print "~~ Checking $sid ~~\n";
> 
> print "\n";
> 
>  
> 
> # open the LogFile
> 
> open SITELOG, "$loc" ||die "Can not open $loc: $!";
> 
>  
> 
> # I suspect that my mistake may be around here :-)
> 
> # Check the file for any ORA- entries
> 
> if($_ =~ m/ORA-/) {
> 
> # If it contains records, reverse the file
> 
> my @lines = reverse($_);
> 
> my $rownum = 0;
> 
> 
> 
> # Starting from the last line look for the error
> 
> for my $line($lines[$rownum]) {
> 
> if ($lines[$rownum] =~ m/ORA-/) {
> 
> print "$lines[$rownum]\n";
> 
> }
> 
> $rownum = $rownum + 1;
> 
> }
> 
> }else{
> 
> print "Nothing to Report\n";
> 
> }
> 
> close SITELOG;
> 
> }
> 
> *** SNIP
> COMPLETE**
> 
>  
> 
> Many Thanks
> 
> Denham
>  << File: ATT781.txt >> 


The Royal Bank of Scotland plc, Registered in Scotland No. 90312. Registered Office: 
36 St Andrew Square, Edinburgh EH2 2YB

The Royal Bank of Scotland plc is authorised and regulated by the Financial Services 
Authority and represents The Royal Bank of Scotland Marketing Group. The Bank sells 
life policies, collective investment schemes and pension products and advises only on 
the Marketing Group's range of these products and on a With-Profit Bond produced by 
Norwich Union Life (RBS) Limited.

This e-mail message is confidential and for use by the addressee only. If the message 
is received by anyone other than the addressee, please return the message to the 
sender by replying to it and then delete the message from your computer. Internet 
e-mails are not necessarily secure. The Royal Bank of Scotland plc does not accept 
responsibility for changes made to this message after it was sent.

Whilst all reasonable care has been taken to avoid the transmission of viruses, it is 
the responsibility of the recipient to ensure that the onward transmission, opening or 
use of this message and any attachments will not adversely affect its systems or data. 
No responsibility is accepted by The Royal Bank of Scotland plc in this regard and the 
recipient should carry out such virus and other checks as it considers appropriate.


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Pls Help with a Basic Script.

2004-08-20 Thread Denham Eva
Please could the wise folks give me some help. Something is wrong and I
can not find out what.

When I run this program it returns everything is OK (Suspect a logic
error somewhere), which is not possible as the logs in question do have
data that I require (i.e. ORA-12571: TNS:packet writer failure).

This script is to check the Oracle Logs for errors beginning with "ORA-"
i.e. ORA-013100

Then it should return only the errors. You will see I try to reverse the
file as I only want the newest errors first, anyway I want to build that
functionality into it eventually that I can set a limit...but that is
for later.

Here is my script.

 

** SNIP ***

 

#!/usr/bin/perl -w

use strict;

use warnings;

# use POSIX 'strftime';

# For later functionality.

# my $day = (strftime('%w', localtime()) - 1);

 

# Save all the sites to be checked in a text file

# Example line:-

# OrcaleSid:://windowsserver/share/directory/logfile.log

 

open SITES, "c:/denham/dba/sites/alrtlogs.txt" || die "Can not Open
alrtlogs.txt: $!";

 

# Now while through the file and do each site.

while () {

(my $sid, my $loc) = split(/::/);

chomp($sid);

chomp($loc);



print "\n";

print "~~ Checking $sid ~~\n";

print "\n";

 

# open the LogFile

open SITELOG, "$loc" ||die "Can not open $loc: $!";

 

# I suspect that my mistake may be around here :-)

# Check the file for any ORA- entries

if($_ =~ m/ORA-/) {

# If it contains records, reverse the file

my @lines = reverse($_);

my $rownum = 0;



# Starting from the last line look for the error

for my $line($lines[$rownum]) {

if ($lines[$rownum] =~ m/ORA-/) {

print "$lines[$rownum]\n";

}

$rownum = $rownum + 1;

}

}else{

print "Nothing to Report\n";

}

close SITELOG;

}

*** SNIP
COMPLETE**

 

Many Thanks

Denham



Re: DBI for FireBird

2004-08-20 Thread David Dorward
On 20 Aug 2004, at 11:03, Cristi Ocolisan wrote:
Can anybody tell me something about a DBI for FireBird?
I looked on CPAN, but didn't find any.
When I go to  
the second hit is subtitled "DBI driver for Firebird" (then it goes on 
to mention InterBase).

--
David Dorward
 

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 



DBI for FireBird

2004-08-20 Thread Cristi Ocolisan
Hi everybody,

 

Can anybody tell me something about a DBI for FireBird?

 

I looked on CPAN, but didn't find any.

 

_

Cristi Ocolisan