source: subversion/applications/rendering/gosmore/dailyUpdate.sh @ 28321

Last change on this file since 28321 was 24484, checked in by nic, 9 years ago

bboxSplit: Fix bug in handling of copyright comment in planet file
dailyUpdate now using ftp

  • Property svn:executable set to *
File size: 2.2 KB
Line 
1#!/bin/bash
2# Copyright 2010 Nic Roets as detailed in the README file.
3# The Osm.org Routing demo daily update script
4# The script runs as a cron job.
5
6# make CFLAGS='-O2 -DRES_DIR=\"/usr/share/gosmore/\" -DHEADLESS -DONLY_ROUTING -DLD_CTRL'
7OSMOSIS=$HOME/osmosis-0.38/bin/osmosis
8FIRST_OSC=$(readlink $HOME/planet-latest.osm.bz2 |
9                         sed 's/[^0-9]\|2$//g')
10# A crude way of getting the date of the planet e.g. 100716
11PLANET=$HOME/planet-$FIRST_OSC.osm.bz2
12# List of change files from youngest to oldest
13cd $HOME/daily
14# Get into working directory
15
16if [ g.o -nt lock ] ||
17   ! wget -c http://planet.openstreetmap.org/daily/$(date -d 'now - 1 day' +%Y%m%d)-$(date +%Y%m%d).osc.gz ||
18   ! gzip --test $(date -d 'now - 1 day' +%Y%m%d)-$(date +%Y%m%d).osc.gz
19then exit 0
20fi
21
22cd $HOME/gosmore
23OSC_LIST="ls -r $HOME/daily/*.gz "
24
25# I tried a number of different things (in comments) before I had success.
26# PARAM=$($OSC_LIST |grep -A 30 20${FIRST_OSC}- |
27#     ( read first
28#       echo --rxc $first
29#       awk '{ print "--rxc ", $1, " --mc conflictResolutionMethod=version" }'))
30# CMD="$OSMOSIS $PARAM --rx /dev/stdin --ac --wx -"
31
32#----
33# nice -n 20 $OSMOSIS $PARAM --wxc week.osc
34# exit 0
35# CMD="$OSMOSIS --rxc week.osc --rx /dev/stdin --ac --wx -"
36
37#----
38# PARAM=$($OSC_LIST |grep -A 30 20${FIRST_OSC}- |
39#    ( read first
40#       echo --rxc $first --rx /dev/stdin --ac
41#       awk '{ print "--rxc ", $1, " --ac" }'))
42# CMD="$OSMOSIS $PARAM --wx -"
43
44#----
45PARAM=$($OSC_LIST |grep -B 30 20${FIRST_OSC}- | awk '{ print "--rxc ", $1 }' )
46AC=$($OSC_LIST    |grep -B 30 20${FIRST_OSC}- | awk '{ print "--ac " }')
47
48CMD="$OSMOSIS $PARAM --rx /dev/stdin $AC --wx -"
49
50echo $CMD
51# exit
52
53if nice -n 20 bzcat $PLANET | nice -n 20 $CMD |
54   (cd relations; nice -n 20 ../gosmore sortRelations) |
55   nice -n 20 ./bboxSplit -89 -179 89 -30 "./gosmore rebuild" g.o \
56                         -89 -30 89 179 "cd e; ../gosmore rebuild" europe/g.o
57then mv america/gosmore.pak am.pak
58     mv europe/gosmore.pak eu.pak
59     mv gosmore.pak america/
60     mv e/gosmore.pak europe/
61     mv relations/relations.tbl .
62fi
63
64sleep 2
65touch lock
66./lockMmap $(date +'24*3600 - (%s - 18*3600) %% (24*3600)' |bc) america/gosmore.pak europe/gosmore.pak
Note: See TracBrowser for help on using the repository browser.