From 70c00eadc2bddbafaf4b7402f3bf20962c5a17db Mon Sep 17 00:00:00 2001 From: Ducky Date: Mon, 2 Oct 2023 16:45:34 +0100 Subject: [PATCH] revert (partial) bcf7ff90d83ce80347764b8e7ae1c5e49dc89119 --- osm-garmin/app/daemon.sh | 23 +++++++++++++++ osm-garmin/app/osm-garmin.sh | 55 ------------------------------------ 2 files changed, 23 insertions(+), 55 deletions(-) create mode 100644 osm-garmin/app/daemon.sh delete mode 100644 osm-garmin/app/osm-garmin.sh diff --git a/osm-garmin/app/daemon.sh b/osm-garmin/app/daemon.sh new file mode 100644 index 0000000..9934671 --- /dev/null +++ b/osm-garmin/app/daemon.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash + +. /app/utils.sh + +sleep_time=3600 +sleep_time_fail=60 + +function wait() { + delay="$1" + echo "💤 Sleeping $delay seconds..." + sleep $delay +} + +while : +do + /app/build-gmap.sh "$OSMGARMIN_REGIONS" "$OSMGARMIN_STYLE" + + if [[ $? == 0 ]]; then + wait $sleep_time + else + wait $sleep_time_fail + fi +done \ No newline at end of file diff --git a/osm-garmin/app/osm-garmin.sh b/osm-garmin/app/osm-garmin.sh deleted file mode 100644 index de504a0..0000000 --- a/osm-garmin/app/osm-garmin.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -. /app/utils.sh - -command="$1" -arguments="${@:2}" -me_filename="$(basename "$(realpath -s "$0")")" - -if [[ "$commnad" == "" ]]; then - die "No command given. See '$me_command help'" -fi - -function exec_daemon() { - sleep_time=3600 - sleep_time_fail=60 - - function wait() { - delay="$1" - echo "💤 Sleeping $delay seconds..." - sleep $delay - } - - while : - do - /app/build-gmap.sh "$OSMGARMIN_REGIONS" "$OSMGARMIN_STYLE" - - if [[ $? == 0 ]]; then - wait $sleep_time - else - wait $sleep_time_fail - fi - done -} - -function exec_help() { - echo "$me_filename - -Usage: - $me_filename daemon / $me_filename - Start daemon to build maps periodically - - $me_filename help - Output this usage text -" - - exit 0 -} - -case "$command" in - ""|"daemon") exec_daemon ;; - "help") exec_help ;; - *) - die "Command '$command' not recognized. See '$me_filename help' for help" - ;; -esac