From 6281a7235564750e0ca4faf3cbe3d6eef046d95f Mon Sep 17 00:00:00 2001 From: Camille TJHOA Date: Mon, 10 Oct 2016 20:45:58 +0200 Subject: [PATCH] Fix #14 --- scripts/cpu_percentage.sh | 2 +- scripts/helpers.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/cpu_percentage.sh b/scripts/cpu_percentage.sh index e0679fd..108f27e 100755 --- a/scripts/cpu_percentage.sh +++ b/scripts/cpu_percentage.sh @@ -11,7 +11,7 @@ print_cpu_percentage() { iostat -c 1 2 | tail -n 2 | head -n 1 | awk '{usage=100-$NF} END {printf("%5.1f%%", usage)}' elif is_osx; then iostat -c 2 disk0 | tail -n 1 | awk '{usage=100-$6} END {printf("%5.1f%%", usage)}' - elif is_freebsd; then + elif is_freebsd || is_openbsd; then iostat -c 2 | tail -n 1 | awk '{usage=100-$NF} END {printf("%5.1f%%", usage)}' else echo "Unknown iostat version please create an issue" diff --git a/scripts/helpers.sh b/scripts/helpers.sh index fce995c..032e802 100644 --- a/scripts/helpers.sh +++ b/scripts/helpers.sh @@ -17,6 +17,10 @@ is_freebsd() { [ $(uname) == "FreeBSD" ] } +is_openbsd() { + [ $(uname) == "OpenBSD" ] +} + is_linux() { [ $(uname) == "Linux" ] }