aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaitinq <30861839+Baitinq@users.noreply.github.com>2020-10-20 11:08:47 +0100
committerGitHub <noreply@github.com>2020-10-20 11:08:47 +0100
commit71f3fd8a776208df0787976e0be720ee8cfe0cf8 (patch)
treee4b71d79b0a24b12002a07214399d7e032ce0dbd
parent8f1feacf875ba299fa415ab6927320409359b0fd (diff)
parent10453b8910890d90055ecf03567f950232710684 (diff)
Merge pull request #18 from Baitinq/master
Added ram percentage module
-rwxr-xr-xmodules/ram_perc13
-rwxr-xr-xmodules/uptime13
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