Keresés

Új hozzászólás Aktív témák

  • Peter789

    senior tag

    válasz SteveBeard #1719 üzenetére

    perl-ben írtam, mert egy nagyobb programba fogom beágyazni később:

    #!/usr/bin/perl

    use strict;

    my $sys_uptime;
    my $wan_uptime;
    my @ifaces;
    my $CNT;

    while (1)
    {
    open (FILE,"</proc/uptime"); ($sys_uptime) = split('\.',<FILE>); close (FILE);
    open (FILE,"</tmp/state/network"); @ifaces = <FILE>; close (FILE);
    for ( $CNT = 0; $CNT < scalar(@ifaces); $CNT++ )
    { if ( substr(@ifaces[$CNT],0,24) eq "network.wan.connect_time" )
    { $wan_uptime = $sys_uptime-substr(@ifaces[$CNT],25,length(@ifaces[$CNT])-26); } }
    print "$wan_uptime\n";
    sleep 1;
    }

    close;

    ----------------------------------------------------------------------------------------------------------------- AquAgorA ...Pál apostol nyomában:                                                                          http://fleettracker.eu/index.php/component/aquagora

Új hozzászólás Aktív témák