leostereo has asked for the wisdom of the Perl Monks concerning the following question:
hi guys, I would like ask why my script is not working as expected, everthing is working good excep the line that exec system ......, it is strange but if I exec the line on a separate script it works and do the job, any help would be preciated.. following , the code
#!/usr/bin/perl -w use strict; use File::Tail; my $file = File::Tail->new( name =>'/var/log/dhcpd.log', interval => 1, maxinterval => 1, resetafter=> 5, ); while (defined(my $line=$file->read)) { print $line,"\n"; if ($line =~ /^(.*) mdz-shaper1 dhcpd: DHCPACK on ([0- +9\.]+) to ([[:xdigit:]:]+).* ([0-9\.]+)/) { my ($date,$client_ip,$client_mac,$master_ip) = + ($1,$2,$3,$4); system "sed -i '/$client_mac/d' /opt/btb_webservice/ve +r3/lease_list.txt"; if(($client_ip)&&($client_mac)&&($master_ip)){ system 'echo "'.$date.' '. $client_ip.' '.$client_mac.' +'. $master_ip.'"'.' >> /opt/btb_webservice/ver3/lease_list.txt'; } } } 1;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: tail script
by NetWallah (Canon) on Dec 09, 2015 at 23:11 UTC | |
|
Re: tail script
by jcb (Parson) on Dec 09, 2015 at 22:52 UTC |