docker-duplicity-cron/cron-exec.sh

19 lines
283 B
Bash
Raw 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
2020-02-14 20:12:07 +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
2020-02-14 20:12:07 +00:00
if eval "$@" 2>> "$LOG"; then
rm -f "$HEALTH_FILE"
else
touch "$HEALTH_FILE"
exit 1;
fi