docker-restic-cron/scripts/cron-exec.sh

19 lines
283 B
Bash
Raw Permalink Normal View History

2019-02-01 21:48:00 +00:00
#! /bin/bash
ENV=/env.sh
2019-02-01 21:48:00 +00:00
LOG=/cron.log
HEALTH_FILE=/unhealthy
2021-06-14 22:55:26 +00:00
if [ -f "$ENV" ]; then
# shellcheck disable=SC1090
source "$ENV"
fi
2019-02-01 21:48:00 +00:00
# Execute command and write output to log
2021-06-14 22:55:26 +00:00
if eval "$@" 2>> "$LOG"; then
rm -f "$HEALTH_FILE"
else
touch "$HEALTH_FILE"
exit 1;
fi