source: subversion/applications/utils/planet.osm/planet.sh @ 7680

Last change on this file since 7680 was 7667, checked in by jonb, 11 years ago

update weekly planet dump script to include relations and exit if anything fails

  • Property svn:executable set to *
File size: 1.4 KB
Line 
1#!/bin/bash
2set -e
3cur_date=`date +%y%m%d`
4cur_planet=planet-${cur_date}.osm
5cur_relation=relations-${cur_date}.osm
6planet_dir=/var/www/planet.openstreetmap.org/
7
8export PATH='/usr/local/bin:/usr/bin:/bin:/usr/bin/X11'
9
10cd ${planet_dir}
11
12planetdump | gzip -9 > .${cur_planet}.gz.new
13planetdump --relations | gzip -9 > .${cur_relation}.gz.new
14mv .${cur_planet}.gz.new ${cur_planet}.gz
15mv .${cur_relation}.gz.new ${cur_relation}.gz
16
17gzip -dc ${cur_planet}.gz | bzip2 -2 > .${cur_planet}.bz2.new
18gzip -dc ${cur_relation}.gz | bzip2 -2 > .${cur_relation}.bz2.new
19mv .${cur_planet}.bz2.new  ${cur_planet}.bz2
20mv .${cur_relation}.bz2.new  ${cur_relation}.bz2
21
22#7zr a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on  planet-`date +%y%m%d.osm`.7z  ${cur_planet}
23#chmod a+r ${cur_planet}.7z
24#mv ${cur_planet}.7z ${planet_dir}
25
26
27#link planet latest to the new file
28ln -fs ${cur_planet}.bz2 planet-latest.osm.bz2
29ln -fs ${cur_relation}.bz2 relations-latest.osm.bz2
30
31#next, create the planet diff from last week to this week
32
33CURPLANETDATE=`echo ${cur_planet}|sed -e 's/\w*-\([0-9]*\).*/\1/'`
34PREVPLANETDATE=`ls *.osm.bz2|grep -B1 ${cur_planet}|head -n1|sed -e 's/\w*-\([0-9]*\).*/\1/'`
35PREVPLANETBZ=planet-${PREVPLANETDATE}.osm.bz2
36TMPFILE=`mktemp`
37
38planetdiff ${PREVPLANETBZ} ${cur_planet}.bz2 | bzip2 -2 > ${TMPFILE}
39chmod +r ${TMPFILE}
40mv ${TMPFILE} ${planet_dir}/planet-${PREVPLANETDATE}-${CURPLANETDATE}.diff.xml.bz2
41
42rm ${cur_planet}.gz
43rm ${cur_relation}.gz
Note: See TracBrowser for help on using the repository browser.