Hi i have acutally this script (see below) and works fine to read the com2 of my linux box (i read news that someone send me to that port) but the problem is :
i received a notice and after the notice i receive a character (let say Y) that say me... ok this is the end of the notice, and i need split the log by notice.
Sorry for my poor english
#!/usr/bin/perl
use Device::SerialPort 0.12;
$LOGDIR = "/var/log"; # path to data file
$LOGFILE = "router.log"; # file name to output to
$PORT = "/dev/ttyS2"; # port to watch
$ob->baudrate(2600) || die "failed setting baudrate";
$ob->parity("none" || die "failed setting parity";
$ob->databits(8) || die "failed setting databits";
$ob->handshake("none" || die "failed setting handshake";
$ob->write_settings || die "no settings";
open(LOG,">>${LOGDIR}/${LOGFILE}"
||die "can't open smdr file $LOGDIR/$LOGFILE for append: $SUB $!\n";
open(DEV, "<$PORT"
|| die "Cannot open $PORT: $_";
select(LOG), $| = 1; # set nonbufferd mode
# Loop forver, logging data to the log file
while($_ = <DEV>){ # print input device to file
print LOG $_;
}
undef $ob;
i received a notice and after the notice i receive a character (let say Y) that say me... ok this is the end of the notice, and i need split the log by notice.
Sorry for my poor english
#!/usr/bin/perl
use Device::SerialPort 0.12;
$LOGDIR = "/var/log"; # path to data file
$LOGFILE = "router.log"; # file name to output to
$PORT = "/dev/ttyS2"; # port to watch
$ob->baudrate(2600) || die "failed setting baudrate";
$ob->parity("none" || die "failed setting parity";
$ob->databits(8) || die "failed setting databits";
$ob->handshake("none" || die "failed setting handshake";
$ob->write_settings || die "no settings";
open(LOG,">>${LOGDIR}/${LOGFILE}"
||die "can't open smdr file $LOGDIR/$LOGFILE for append: $SUB $!\n";
open(DEV, "<$PORT"
|| die "Cannot open $PORT: $_";
select(LOG), $| = 1; # set nonbufferd mode
# Loop forver, logging data to the log file
while($_ = <DEV>){ # print input device to file
print LOG $_;
}
undef $ob;