From 67d9375e406da2f2e552e7b58890647109bd4611 Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 14 Jun 2023 16:10:18 -0400 Subject: [PATCH] Added prependability to the table --- perl/tempmon.pl | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/perl/tempmon.pl b/perl/tempmon.pl index 248b549..b4baeb3 100644 --- a/perl/tempmon.pl +++ b/perl/tempmon.pl @@ -51,6 +51,8 @@ sub diskheader { printf("%-10s", "Time"); for (@disks) {printf("%-5s",$_);} printf("\n"); } sub headerlines {printf("%-10s", "---------+"); for (@disks) {printf("%-5s","----+");} printf("\n");} +my $preheaded=0; +printf("\n"); # placeholder ;) diskheader(); headerlines(); my $headertracker=0; @@ -75,6 +77,14 @@ while (1) { } close $cmd; } + # We can't get the basic stats until at least one run-through of the smart output + # so this prepends the types of disks to the table header + if (not $preheaded) { + printf("%s",`tput cuu1; tput cuu1; tput cuu1; tput cub 80`); + diskheader(); + printf("%s\n",`tput cub 80;`); + $preheaded=1; + } printf("\n"); printf("%s","Sleeping for $INTERVAL seconds..."); $headertracker=$headertracker+1;