Skip to content

Instantly share code, notes, and snippets.

@rbraband
Created October 20, 2014 13:53
Show Gist options
  • Save rbraband/cb81602dec33774daea6 to your computer and use it in GitHub Desktop.
Save rbraband/cb81602dec33774daea6 to your computer and use it in GitHub Desktop.
Graphhopper weekly update script for Windows Task-Scheduler
@ECHO OFF && PUSHD "%~dp0" && SETLOCAL
ECHO [%date% - %time%] Log start > download.log
SC Stop Graphhopper > nul
RENAME europe-latest.osm.pbf old_europe-latest.osm.pbf
REM Wget: retrieve files from the WWW http://gnuwin32.sourceforge.net/packages/wget.htm
WGET --no-verbose --append-output=download.log --tries=3 http://download.geofabrik.de/europe-latest.osm.pbf
IF exist %~dp0\europe-latest.osm.pbf (
ECHO [%date% - %time%] Download successful >> download.log
DEL old_europe-latest.osm.pbf
PUSHD %~dp0\europe-latest.osm-gh
IF errorlevel 0 (
RD /q /s . 2> NUL
POPD
)
SC Start Graphhopper > nul
ECHO [%date% - %time%] Log end >> download.log
EXIT /b 0
) ELSE (
ECHO [%date% - %time%] Unable to download new osm file, aborting >> download.log
RENAME old_europe-latest.osm.pbf europe-latest.osm.pbf
SC Start Graphhopper > nul
ECHO [%date% - %time%] Log end >> download.log
EXIT /b 1
)
@rbraband
Copy link
Author

For the windows service I used NSSM - the Non-Sucking Service Manager http://nssm.cc/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment