[osm-tile-server] 53/117: Improved osm-tile-server-process

Ruben Undheim rubund-guest at moszumanska.debian.org
Tue Nov 3 23:18:19 UTC 2015


This is an automated email from the git hooks/post-receive script.

rubund-guest pushed a commit to branch master
in repository osm-tile-server.

commit afb70409b4402ee0cd90ed9ef58642f41dfddd90
Author: Ruben Undheim <ruben.undheim at gmail.com>
Date:   Fri Sep 4 08:40:52 2015 +0200

    Improved osm-tile-server-process
---
 scripts/osm-tile-server-process | 12 ++++++++++++
 src/osm-tile-server-status.c    | 10 ++++++++++
 2 files changed, 22 insertions(+)

diff --git a/scripts/osm-tile-server-process b/scripts/osm-tile-server-process
index 9562330..1b5bd55 100755
--- a/scripts/osm-tile-server-process
+++ b/scripts/osm-tile-server-process
@@ -1,5 +1,13 @@
 #!/bin/bash
 
+failed(){
+    echo "Failed"
+    osm-tile-server-status todo
+    exit -1
+}
+trap failed SIGINT
+trap failed SIGTERM
+
 set -e
 
 set +e
@@ -7,7 +15,11 @@ cat /var/cache/osm-tile-server-base/status.txt | grep -q TODO
 RET=$?
 set -e
 if [ "$RET" = "0" ] ; then
+    osm-tile-server-status inprogress
     osm-tile-server-download Norway
     osm-tile-server-import /var/cache/osm-tile-server-base/downloaded.osm.pbf
     osm-tile-server-status done
+else
+    echo "Nothing to do"
+    echo "Run \"sudo dpkg-reconfigure osm-tile-server-base\" to configure OSM tile server"
 fi
diff --git a/src/osm-tile-server-status.c b/src/osm-tile-server-status.c
index 54ec14c..1d0c0d1 100644
--- a/src/osm-tile-server-status.c
+++ b/src/osm-tile-server-status.c
@@ -25,6 +25,16 @@ int main(int argc, char **argv)
 		fprintf(wfile,"DONE");
 		fclose(wfile);
 	}
+	else if(strncmp(cmd,"inprogress",10) == 0) {
+		wfile = fopen("/var/cache/osm-tile-server-base/status.txt","w");
+		fprintf(wfile,"INPROGRESS");
+		fclose(wfile);
+	}
+	else if(strncmp(cmd,"todo",4) == 0) {
+		wfile = fopen("/var/cache/osm-tile-server-base/status.txt","w");
+		fprintf(wfile,"TODO");
+		fclose(wfile);
+	}
 
 	//snprintf(command,255,"osm2pgsql --slim -d %s --cache-strategy sparse -C 100 --hstore -S /usr/share/osm2pgsql/default.style %s",dbname,pbffile);
 	//printf("Importing to database with this command:\n\n");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osm-tile-server.git



More information about the Pkg-grass-devel mailing list