Old stuff/Perl/uptime.pl
(Deskargatu)
#!/usr/bin/perl -w
# Uptime Script
# Pour le sport :)
my %uptime;
open(INFO,"/proc/uptime");
<INFO> =~ /^(\d+)/;
close INFO;
my $sec = $1;
$uptime{"Jour"} = int($sec/60/60/24);
$sec = $sec-$uptime{"Jour"}*60*60*24;
$uptime{"Heure"} = int($sec/60/60);
$sec = $sec-$uptime{"Heure"}*60*60;
$uptime{"Minute"} = int($sec/60);
if (!$uptime{"Jour"} or $uptime{"Jour"} == 1) { print $uptime{'Jour'}."Jour "; }
else { print "$uptime{'Jour'} Jours "; }
if (!$uptime{"Heure"} or $uptime{"Heure"} == 1) { print $uptime{'Heure'}." Heure "; }
else { print "$uptime{'Minute'} Heures "; }
if (!$uptime{"Minute"} or $uptime{"Minute"} == 1) { print $uptime{'Minute'}." Minute \n"; }
else { print "$uptime{'Minute'} Minutes.\n"; }