Handle 'day' in uptime
authorJamie Cameron <jcameron@webmin.com>
Tue, 30 Jun 2009 23:33:44 +0000 (23:33 +0000)
committerJamie Cameron <jcameron@webmin.com>
Tue, 30 Jun 2009 23:33:44 +0000 (23:33 +0000)
blue-theme/right.cgi

index 9a2b91d..82fe06f 100755 (executable)
@@ -61,19 +61,19 @@ if ($level == 0) {
        # System uptime
        $out = &backquote_command("LC_ALL='' LANG='' uptime");
        $uptime = undef;
-       if ($out =~ /up\s+(\d+)\s+days,\s+(\d+):(\d+)/) {
+       if ($out =~ /up\s+(\d+)\s+(day|days),\s+(\d+):(\d+)/) {
                # up 198 days,  2:06
-               $uptime = &text('right_updays', int($1), int($2), int($3));
+               $uptime = &text('right_updays', int($1), int($3), int($4));
                }
-       elsif ($out =~ /up\s+(\d+)\s+days,\s+(\d+)\s+min/) {
+       elsif ($out =~ /up\s+(\d+)\s+(day|days),\s+(\d+)\s+min/) {
                # up 198 days,  10 mins
-               $uptime = &text('right_updays', int($1), 0, int($2));
+               $uptime = &text('right_updays', int($1), 0, int($3));
                }
        elsif ($out =~ /up\s+(\d+):(\d+)/) {
                # up 3:10
                $uptime = &text('right_uphours', int($1), int($2));
                }
-       elsif ($out =~ /up\s+(\d+)\s+mins/) {
+       elsif ($out =~ /up\s+(\d+)\s+min/) {
                # up 45 mins
                $uptime = &text('right_upmins', int($1));
                }