Skip to content

Commit

Permalink
Add automatic retry
Browse files Browse the repository at this point in the history
Co-authored-by: Kevin Krotzer <[email protected]>
Co-authored-by: Zach Butler <[email protected]>
  • Loading branch information
goatbased and kj4ezj committed Feb 27, 2024
1 parent 0c31a5d commit fe639f6
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions entry.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
#!/bin/sh
while true; do
DATE="$(date)"
RUN_TIME="$(date '+%s')"
# shellcheck disable=SC2086
/zap2xml.pl -u "$USERNAME" -p "$PASSWORD" -U -o "/data/$XMLTV_FILENAME" $OPT_ARGS
echo "Last run time: $DATE"
echo "Will run in $SLEEPTIME seconds"
sleep "$SLEEPTIME"
printf 'Run time: '
date -d "@$RUN_TIME" '+%F %T %Z'
MOD_TIME="$(date -r "/data/$XMLTV_FILENAME" '+%s')"
if test "$MOD_TIME" -gt "$RUN_TIME"; then
echo "Will run again in $SLEEPTIME seconds."
sleep "$SLEEPTIME"
else
echo 'This run did not complete successfully.'
echo 'Pausing for 30 seconds and trying again...'
sleep 30
fi
done

0 comments on commit fe639f6

Please sign in to comment.