Thread hab probleme einfachen php code in perl nachzubauen (5 answers)
Opened by SLFraggeR at 2008-07-29 10:51

topeg
 2008-07-29 13:03
#112857 #112857
User since
2006-07-10
2611 Artikel
BenutzerIn

user image
Das funktioniert bei mir:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl

use strict;
use warnings;
use LWP::Simple;

my $ipconf='/etc/lighttpd/server_ip.conf';
my $site='http://%s/ldirector.html';

open(my $fh, '<', $ipconf) or die($!);
my $ip=<$fh>;
$ip=~s/^.+"([^"]+?)".+$/$1/s;
close($fh);

unless(get(sprintf($site,$ip)))
{print 1; exit;}

my $uptime=`uptime`;
(my $load)=$uptime=~/load average:\s+([\d.]+)/;
$load*=100;

if($load>400)
{print 0; exit;}

print 100-int($load/4);
exit;

View full thread hab probleme einfachen php code in perl nachzubauen