/[cricket]/getload
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /getload

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Wed Apr 30 19:49:49 2003 UTC (20 years, 11 months ago) by dpavlin
Branch: MAIN
Changes since 1.1: +25 -12 lines
rewritten shell script in perl, now supports hosts which are up less than
a day (what a stupid bug!)

1 dpavlin 1.2 #!/usr/bin/perl -w
2    
3     if ($#ARGV == 0) {
4     open(UPTIME,"ruptime |") || die "ruptime: $!";
5     while(<UPTIME>) {
6     chomp;
7     if (/$ARGV[0].*(\d+) user.+load.+([\d\.]+), ([\d\.]+), ([\d\.]+)/) {
8     print "$2\n$3\n$4\n$1\n";
9     # } else {
10     # print "skip: $_\n";
11     }
12     }
13     } else {
14     shift @ARGV; # ship hostname (used for ruptime)
15     my $cmd = join(" ",@ARGV);
16     open(UPTIME,"$cmd |") || die "$cmd: $!";
17     while(<UPTIME>) {
18     chomp;
19     if (/(\d+) user.+load.+([\d\.]+), ([\d\.]+), ([\d\.]+)/) {
20     print "$2\n$3\n$4\n$1\n";
21     # } else {
22     # print "skip: $_\n";
23     }
24     }
25     }

  ViewVC Help
Powered by ViewVC 1.1.26