summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSt33v <github@f3rr3t.com>2022-01-11 18:12:35 +1100
committerSt33v <github@f3rr3t.com>2022-01-11 18:12:35 +1100
commit9bf05ca7cdc1267a67fd9460590cfff105ae0cd6 (patch)
treea484741054a32ab58036c4ae07cfe81398ab1834
parentb9fc59b5bde345ac7b628c715ce7d5f97ccdac3c (diff)
rudimentary handling of "no file at remote site"
-rwxr-xr-xsynopticChart.sh17
1 files changed, 16 insertions, 1 deletions
diff --git a/synopticChart.sh b/synopticChart.sh
index b18b6e2..5fcd2f7 100755
--- a/synopticChart.sh
+++ b/synopticChart.sh
@@ -15,7 +15,22 @@ dateTime=$(DeriveTime)
latestChart=IDY00030.${dateTime}.pdf
+# -q no config file lookup
+# -f fail early
+# -s silent
+curl -q -fs -o ${latestChart} ftp://ftp.bom.gov.au/anon/gen/fwo/${latestChart}
+curlExit=$?
+
+
+if [ $curlExit -gt 0 ] ; then
+ # Did we find a file? (Maybe it has not been created yet).
+ if [ $curlExit -eq 78 ] ; then
+ echo "No file at remote site $curlExit"
+ # todo create a one-shot timer service
+ fi
+ exit $curlExit
+fi
+
-curl -o ${latestChart} ftp://ftp.bom.gov.au/anon/gen/fwo/${latestChart}
convert -density 300 ${latestChart} ${dateTime}.png