source: subversion/applications/utils/mod_tile/openstreetmap-tiles-update-expire.sh @ 28681

Last change on this file since 28681 was 26890, checked in by apmon, 8 years ago

Add a script to update a osm2pgsql db and expire tiles
Add a demonstration slippymap to access local rendered tiles

  • Property svn:executable set to *
File size: 1.2 KB
Line 
1#!/bin/sh
2
3set -e
4
5BASE_DIR=/var/lib/mod_tile
6WORKOSM_DIR=$BASE_DIR/.osmosis
7LOCKFILE=/tmp/openstreetmap-update-expire-lock.txt
8CHANGE_FILE=$BASE_DIR/changes.osc.gz
9EXPIRY_FILE=$BASE_DIR/dirty_tiles
10
11if [ $# -eq 1 ] ; then
12    echo "Initialising Osmosis replication system to " $1
13    mkdir $WORKOSM_DIR
14    osmosis --read-replication-interval-init workingDirectory=$WORKOSM_DIR
15    wget "http://toolserver.org/~mazder/replicate-sequences/?"$1"T00:00:00Z" -O $WORKOSM_DIR/state.txt
16else
17    echo "Updating tile server at " `date`
18
19    if [ -e ${LOCKFILE} ] && kill -0 `cat ${LOCKFILE}`; then
20        echo "already running"
21        exit
22    fi
23   
24# make sure the lockfile is removed when we exit and then claim it
25    trap "rm -f ${LOCKFILE}; exit" INT TERM EXIT
26    echo $$ > ${LOCKFILE}
27   
28   
29   
30    rm $EXPIRY_FILE || true
31    touch $EXPIRY_FILE
32   
33    if [ ! -f ${CHANGE_FILE} ] ; then
34        osmosis --read-replication-interval workingDirectory=$WORKOSM_DIR --simplify-change --write-xml-change $CHANGE_FILE
35    fi
36    osm2pgsql -a --slim -e 15:15 -o $EXPIRY_FILE $CHANGE_FILE
37    render_expired --min-zoom=10 --max-zoom=18 --touch-from=10 -s /var/run/renderd.sock < $EXPIRY_FILE
38   
39    rm $CHANGE_FILE
40    rm -f ${LOCKFILE}
41   
42fi
Note: See TracBrowser for help on using the repository browser.