diff options
author | Baitinq <30861839+Baitinq@users.noreply.github.com> | 2020-10-20 11:08:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-20 11:08:47 +0100 |
commit | 71f3fd8a776208df0787976e0be720ee8cfe0cf8 (patch) | |
tree | e4b71d79b0a24b12002a07214399d7e032ce0dbd | |
parent | 8f1feacf875ba299fa415ab6927320409359b0fd (diff) | |
parent | 10453b8910890d90055ecf03567f950232710684 (diff) |
Merge pull request #18 from Baitinq/master
Added ram percentage module
-rwxr-xr-x | modules/ram_perc | 13 | ||||
-rwxr-xr-x | modules/uptime | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/modules/ram_perc b/modules/ram_perc new file mode 100755 index 0000000..40c2b2f --- /dev/null +++ b/modules/ram_perc @@ -0,0 +1,13 @@ +#!/bin/bash + +# Prints the total ram and used ram in Mb + +PREFIX=' ' + +get_ram() +{ + USED_RAM=$(free | awk '/Mem/{printf("%d"), $3/$2*100}') + echo "$PREFIX$USED_RAM%" +} + +get_ram diff --git a/modules/uptime b/modules/uptime new file mode 100755 index 0000000..2c771d4 --- /dev/null +++ b/modules/uptime @@ -0,0 +1,13 @@ +#!/bin/bash + +# Prints the total ram and used ram in Mb + +PREFIX='' + +get_uptime() +{ + UPTIME=$(uptime | sed 's/.*up \([^,]*\), .*/\1/') + echo "$PREFIX$UPTIME" +} + +get_uptime |