summaryrefslogtreecommitdiffstats
path: root/remote/lib/status.sh
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2019-08-25 06:06:41 +0200
committerSuren A. Chilingaryan <csa@suren.me>2019-08-25 06:06:41 +0200
commit16e27beaa24c6c551eaa0d3e6d115017939593a1 (patch)
tree61aea994bfc76e9f0053b26a42406e456c2a962e /remote/lib/status.sh
parentb2d1ca40d5bd1015a37cc243000b636eefc3d128 (diff)
downloadconky-16e27beaa24c6c551eaa0d3e6d115017939593a1.tar.gz
conky-16e27beaa24c6c551eaa0d3e6d115017939593a1.tar.bz2
conky-16e27beaa24c6c551eaa0d3e6d115017939593a1.tar.xz
conky-16e27beaa24c6c551eaa0d3e6d115017939593a1.zip
Support multi-reports
Diffstat (limited to 'remote/lib/status.sh')
-rw-r--r--remote/lib/status.sh17
1 files changed, 9 insertions, 8 deletions
diff --git a/remote/lib/status.sh b/remote/lib/status.sh
index 644f20a..95e7bbb 100644
--- a/remote/lib/status.sh
+++ b/remote/lib/status.sh
@@ -1,6 +1,7 @@
. lib/parameters.sh
. lib/print.sh
. lib/report.sh
+. lib/run.sh
function check_server_traffic {
local result="$1"
@@ -97,7 +98,7 @@ function check_server_status {
service_status=${BASH_REMATCH[1]}
service_output=$(sed "1 d" <<< "$service_output")
if [ -n "${BASH_REMATCH[2]}" ]; then
- service_header=$(sed -r "s/\\$\{color\s+([^}]*)\}/$(set_color \\1)/g" <<< "${BASH_REMATCH[2]}") #"
+ service_header=$(sed -r "s/\\$\{color\s+([^}]*)\}/\$(set_color \\1)/g" <<< "${BASH_REMATCH[2]}") #"
headers="$headers $service_header"
fi
else
@@ -144,21 +145,21 @@ function check_service {
health=${BASH_REMATCH[2]}
header=${BASH_REMATCH[3]}
- output=$(sed '$ d' <<< $ouput)
+ output=$(sed '$ d' <<< "$output")
fi
print_status "$online"
print_status "$health"
- headers=$(sed -r "s/\\$\{color\s+([^}]*)\}/$(set_color \\1)/g" <<< "$header") # "
- print " ::: ${headers}"
+ header=$(sed -r "s/\\$\{color\s+([^}]*)\}/\$(set_color \\1)/g" <<< "$header") # "
+ print " ::: ${header}"
- important=$(grep "^\*" <<< $output)
- messages=$(grep -v "^\*" <<< $output)
+ important=$(grep "^\*" <<< "$output")
+ messages=$(grep -v "^\*" <<< "$output")
if [ -n "$output" ]; then
- output="\n$(decorate "$service:$id" "cyan" "u")\n$(set_color white)$important\n$(reset_color)$messages\n"
+ output="\n$(decorate "$service:$id" "cyan" "u")\n$important\n$(set_color gray)$messages$(reset_color)\n"
flock -x $0 echo "${output}" >&12
fi
}
@@ -170,7 +171,7 @@ function check__ {
read -ra args <<< "$1" && shift
local host=${args[0]};
- print "$(decorate $title "purple") ::: " | sed -r "s/\\$\{color\s+([^}]*)\}/$(set_color \\1)/g; "
+ print "$(decorate $title "purple") ::: " | sed -r "s/\\$\{color\s+([^}]*)\}/\$(set_color \\1)/g; "
local service
for service in "$@"; do