#!/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