parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DIff: make "niceload" work on BSD


From: Michał Markowski
Subject: DIff: make "niceload" work on BSD
Date: Wed, 31 Oct 2012 14:44:51 +0100

Hi, "uptime" output on OpenBSD and FreeBSD (so probably NetBSD and DragonflyBSD too) look similar to this:
 2:22PM  up 30 days, 13:44, 1 user, load averages: 0.06, 0.09, 0.13

so this diff should fix "uptime|" parsing in niceload:

--- /tmp/parallel-20121022/src/niceload Mon Oct 22 23:20:41 2012
+++ /usr/local/bin/niceload     Wed Oct 31 14:10:28 2012
@@ -569,7 +569,7 @@
        close IN;
     } elsif (open(IN,"uptime|")) {
        my $upString = <IN>;
-       if($upString =~ m/average.\s*(\d+\.\d+)/) {
+       if($upString =~ m/averages?.\s*(\d+\.\d+)/) {
            $loadavg = $1;
        } else {
            ::die_bug("uptime");


Drop me a line whether it's ok.


--
Michał Markowski

reply via email to

[Prev in Thread] Current Thread [Next in Thread]