From f491641ab809dde56c60052bebc737bdde0f7995 Mon Sep 17 00:00:00 2001 From: midoks Date: Sun, 5 Feb 2023 12:25:57 +0800 Subject: [PATCH] Create cpu_usage.sh --- plugins/op_waf/shell/cpu_usage.sh | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 plugins/op_waf/shell/cpu_usage.sh diff --git a/plugins/op_waf/shell/cpu_usage.sh b/plugins/op_waf/shell/cpu_usage.sh new file mode 100644 index 000000000..7ea6e3009 --- /dev/null +++ b/plugins/op_waf/shell/cpu_usage.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +DST_DIR=/www/server/op_waf +DIS_FILE=${DST_DIR}/cpu.info + +CPU_USAGE=`top -bn 1 | fgrep 'Cpu(s)' | awk '{print 100 -$8}' | awk -F . '{print $1}'` +echo $CPU_USAGE > $DIS_FILE \ No newline at end of file