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

Last change on this file since 7666 was 7666, checked in by jonb, 12 years ago

weekly planet dump script updated not to rely on using planetdump from Steve's directory

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