aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--backup-cloud.rsc2
-rw-r--r--backup-upload.rsc2
-rw-r--r--check-health.rsc6
-rw-r--r--global-functions.rsc8
4 files changed, 11 insertions, 7 deletions
diff --git a/backup-cloud.rsc b/backup-cloud.rsc
index 9a062f2..8e29c67 100644
--- a/backup-cloud.rsc
+++ b/backup-cloud.rsc
@@ -71,7 +71,7 @@
message=("Uploaded backup for " . $Identity . " to cloud.\n\n" . \
[ $DeviceInfo ] . "\n\n" . \
[ $FormatLine "Name" ($Cloud->"name") ] . "\n" . \
- [ $FormatLine "Size" ([ $HumanReadableNum ($Cloud->"size") 1024 ] . "iB") ] . "\n" . \
+ [ $FormatLine "Size" ([ $HumanReadableNum ($Cloud->"size") 1024 ] . "B") ] . "\n" . \
[ $FormatLine "Download key" ($Cloud->"secret-download-key") ]); silent=true });
} else={
$SendNotification2 ({ origin=$ScriptName; \
diff --git a/backup-upload.rsc b/backup-upload.rsc
index 18223bb..63e5b7f 100644
--- a/backup-upload.rsc
+++ b/backup-upload.rsc
@@ -140,7 +140,7 @@
:return \
[ $IfThenElse ([ :typeof $File ] = "array") \
($Name . ":\n" . [ $FormatLine " name" ($File->"name") ] . "\n" . \
- [ $FormatLine " size" ([ $HumanReadableNum ($File->"size") 1024 ] . "iB") ]) \
+ [ $FormatLine " size" ([ $HumanReadableNum ($File->"size") 1024 ] . "B") ]) \
[ $FormatLine $Name $File ] ];
}
diff --git a/check-health.rsc b/check-health.rsc
index 1e8fcc0..a769fa8 100644
--- a/check-health.rsc
+++ b/check-health.rsc
@@ -64,9 +64,9 @@
$SendNotification2 ({ origin=$ScriptName; \
subject=([ $SymbolForNotification "card-file-box,chart-increasing" ] . "Health warning: RAM utilization"); \
message=("The RAM utilization on " . $Identity . " is at " . $CheckHealthRAMUtilization . "%!\n\n" . \
- [ $FormatLine "total" ([ $HumanReadableNum ($Resource->"total-memory") 1024 ] . "iB") 8 ] . "\n" . \
- [ $FormatLine "used" ([ $HumanReadableNum ($Resource->"total-memory" - $Resource->"free-memory") 1024 ] . "iB") 8 ] . "\n" . \
- [ $FormatLine "free" ([ $HumanReadableNum ($Resource->"free-memory") 1024 ] . "iB") 8 ]) });
+ [ $FormatLine "total" ([ $HumanReadableNum ($Resource->"total-memory") 1024 ] . "B") 8 ] . "\n" . \
+ [ $FormatLine "used" ([ $HumanReadableNum ($Resource->"total-memory" - $Resource->"free-memory") 1024 ] . "B") 8 ] . "\n" . \
+ [ $FormatLine "free" ([ $HumanReadableNum ($Resource->"free-memory") 1024 ] . "B") 8 ]) });
:set CheckHealthRAMUtilizationNotified true;
}
:if ($CheckHealthRAMUtilization < 70 && $CheckHealthRAMUtilizationNotified = true) do={
diff --git a/global-functions.rsc b/global-functions.rsc
index c8fec8d..aa39118 100644
--- a/global-functions.rsc
+++ b/global-functions.rsc
@@ -578,11 +578,13 @@
:local Base [ :tonum $2 ];
:global EitherOr;
+ :global IfThenElse;
:local Prefix "kMGTPE";
:local Pow 1;
:set Base [ $EitherOr $Base 1024 ];
+ :local Bin [ $IfThenElse ($Base = 1024) "i" "" ];
:if ($Input < $Base) do={
:return $Input;
@@ -595,9 +597,11 @@
:local Tmp1 ($Input * 100 / $Pow);
:local Tmp2 ($Tmp1 / 100);
:if ($Tmp2 >= 100) do={
- :return ($Tmp2 . $Prefix);
+ :return ($Tmp2 . $Prefix . $Bin);
}
- :return ($Tmp2 . "." . [ :pick $Tmp1 [ :len $Tmp2 ] ([ :len $Tmp1 ] - [ :len $Tmp2 ] + 1) ] . $Prefix);
+ :return ($Tmp2 . "." . \
+ [ :pick $Tmp1 [ :len $Tmp2 ] ([ :len $Tmp1 ] - [ :len $Tmp2 ] + 1) ] . \
+ $Prefix . $Bin);
}
}
}