File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+
3
+ # Assign the filename
4
+ filename=" /root/digiroad.sh"
5
+
6
+ # Get offline version info
7
+ offlineversion=0
8
+
9
+ # Get latest data from Digiroad server
10
+ onlineversion=$( curl -s -I https://ava.vaylapilvi.fi/ava/Tie/Digiroad/Aineistojulkaisut/latest/KokoSuomi_DIGIROAD_R_EUREF-FIN.zip | awk ' /last-modified/{ date=""; for(i=2;i<=NF;++i) date=(date " " $i); print date;}' | xargs -I{} date -d {} +" %s" )
11
+
12
+ # Compare if online version is newer than previously recorded
13
+ if [ $onlineversion -gt $offlineversion ]
14
+ then
15
+ echo New KokoSuomi_DIGIROAD_R_EUREF-FIN.zip detected. Downloading to /opt/KokoSuomi_DIGIROAD_R_EUREF-FIN.zip
16
+ curl -o /opt/KokoSuomi_DIGIROAD_R_EUREF-FIN.zip https://ava.vaylapilvi.fi/ava/Tie/Digiroad/Aineistojulkaisut/latest/KokoSuomi_DIGIROAD_R_EUREF-FIN.zip
17
+ # Change latest digiroad version for downloaded version
18
+ sed -i " s/$offlineversion /$onlineversion /" $filename
19
+
20
+ else
21
+ echo No new version of KokoSuomi_DIGIROAD_R_EUREF-FIN.zip found.
22
+ fi
23
+ echo Done
You can’t perform that action at this time.
0 commit comments