Files
mtusi2026lab7/scripts/reconcile-loop.sh
T
2026-11-04 19:22:35 +03:00

34 lines
698 B
Bash
Executable File

#!/bin/sh
set -eu
cd "$(dirname "$0")/.."
interval=${RECONCILE_INTERVAL_SECONDS:-900}
grace=${RECONCILE_GRACE_SECONDS:-3600}
case "$interval" in
''|*[!0-9]*)
echo "RECONCILE_INTERVAL_SECONDS must be an integer" >&2
exit 2
;;
esac
case "$grace" in
''|*[!0-9]*)
echo "RECONCILE_GRACE_SECONDS must be an integer" >&2
exit 2
;;
esac
if [ "$interval" -lt 60 ]; then
echo "RECONCILE_INTERVAL_SECONDS must be at least 60" >&2
exit 2
fi
if [ "$grace" -lt 60 ]; then
echo "RECONCILE_GRACE_SECONDS must be at least 60" >&2
exit 2
fi
while :
do
python3 src/reconcile.py --grace-seconds "$grace" --apply
sleep "$interval"
done