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

Last change on this file since 12038 was 9300, checked in by jonb, 11 years ago

update planet dump script to add md5sum files

  • Property svn:executable set to *
File size: 2.0 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
16md5sum ${cur_planet}.gz > ${cur_planet}.gz.md5
17md5sum ${cur_relation}.gz > ${cur_relation}.gz.md5
18
19gzip -dc ${cur_planet}.gz | bzip2 -2 > .${cur_planet}.bz2.new
20gzip -dc ${cur_relation}.gz | bzip2 -2 > .${cur_relation}.bz2.new
21mv .${cur_planet}.bz2.new  ${cur_planet}.bz2
22mv .${cur_relation}.bz2.new  ${cur_relation}.bz2
23md5sum ${cur_planet}.bz2 > ${cur_planet}.bz2.md5
24md5sum ${cur_relation}.bz2 > ${cur_relation}.bz2.md5
25
26#7zr a -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on  planet-`date +%y%m%d.osm`.7z  ${cur_planet}
27#chmod a+r ${cur_planet}.7z
28#mv ${cur_planet}.7z ${planet_dir}
29
30
31#link planet latest to the new file
32ln -fs ${cur_planet}.bz2 planet-latest.osm.bz2
33ln -fs ${cur_relation}.bz2 relations-latest.osm.bz2
34# mangle md5 files for 'latest' ones
35rm -f planet-latest.osm.bz2.md5 relations-latest.osm.bz2.md5
36sed -e "s/${cur_planet}.bz2/planet-latest.osm.bz2/" ${cur_planet}.bz2.md5 > planet-latest.osm.bz2.md5
37sed -e "s/${cur_relation}.bz2/relations-latest.osm.bz2/" ${cur_relation}.bz2.md5 > relations-latest.osm.bz2.md5
38
39#next, create the planet diff from last week to this week
40
41CURPLANETDATE=`echo ${cur_planet}|sed -e 's/\w*-\([0-9]*\).*/\1/'`
42PREVPLANETDATE=`ls *.osm.bz2|grep -B1 ${cur_planet}|head -n1|sed -e 's/\w*-\([0-9]*\).*/\1/'`
43PREVPLANETBZ=planet-${PREVPLANETDATE}.osm.bz2
44TMPFILE=`mktemp`
45
46planetdiff ${PREVPLANETBZ} ${cur_planet}.bz2 | bzip2 -2 > ${TMPFILE}
47chmod +r ${TMPFILE}
48mv ${TMPFILE} ${planet_dir}/planet-${PREVPLANETDATE}-${CURPLANETDATE}.diff.xml.bz2
49
50rm ${cur_planet}.gz
51rm ${cur_relation}.gz
52rm ${cur_planet}.gz.md5
53rm ${cur_relation}.gz.md5
Note: See TracBrowser for help on using the repository browser.