#!/bin/bash for monitor in storage/data/*; do if [[ "$(tail -n1 < $monitor | jq -r '.status')" == 1 ]]; then label="$(tail -n1 < $monitor | jq -r '.label')" label_sha="$(shasum <<< "$label" | cut -c 1-16)" if [[ ! -f "storage/reports/$label_sha" ]]; then for file in storage/appconfig/every_*.json; do data="$(jq -r '.[] | select(.label == "'"$label"'")' $file)" if [[ "$data" != '' ]]; then break fi done notify="$(jq -r '.notify[]' <<< "$data")" if [[ "$notify" != '' ]]; then source "${cfg[namespace]}/code/func.sh" notify "$notify" 1 touch "storage/reports/$label_sha" fi fi fi done