You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
475 B

#!/usr/bin/env bash
UMBREL_ROOT="$(readlink -f $(dirname "${BASH_SOURCE[0]}")/..)"
resource="${1}"
interval="${2}"
log () {
echo "$(date "+%Y-%m-%d %H:%M:%S") ${@}"
}
log "Status monitor for \"${resource}\" running every ${interval} seconds!"
status_script="${UMBREL_ROOT}/scripts/status/${resource}"
json_path="${UMBREL_ROOT}/statuses/${resource}-status.json"
while true; do
result=$("${status_script}")
echo "$result" > "${json_path}"
sleep "${interval}"
done