+++ /dev/null
-#!/bin/bash
-
-# DO NOT EDIT - This file is being maintained by Chef
-
-set -e
-user=`whoami`
-if [ "$user" != "www-data" ];
- then
- echo 'Error: run as www-data'
- exit 1
- fi
-
-if [ -f /tmp/planet2pbf.lock ]; then
- if [ "$(ps -p `cat /tmp/planet2pbf.lock` | wc -l)" -gt 1 ]; then
- echo planet2pbf process is still running
- exit 1
- else
- # process not running, but lock file not deleted?
- rm /tmp/planet2pbf.lock
- fi
-fi
-echo $$ >/tmp/planet2pbf.lock
-
-YEARFULL=`TZ=GMT+24 date +%Y`
-
-cd /store/planet/planet/
-if [ -z $1 ]
-then
- YEAR=`TZ=GMT+24 date +%y`
- MONTH=`TZ=GMT+24 date +%m`
- DAY=`TZ=GMT+24 date +%d`
- if [ -f ${YEARFULL}/planet-${YEAR}${MONTH}${DAY}.osm.bz2 -o -f ${YEARFULL}/.planet-${YEAR}${MONTH}${DAY}.osm.bz2.new ];
- then
- planet=planet-${YEAR}${MONTH}${DAY}.osm
- else
- echo Error /store/planet/planet/${YEARFULL}/planet-${YEAR}${MONTH}${DAY}.osm.bz2 not available
- exit 1
- fi
-else
- planet=$1
-fi
-while [ -f ${YEARFULL}/.${planet}.bz2.new ];
-do
- echo sleeping - ${planet}.bz2
- sleep 300
-done
-if [ -f /store/planet/planet/${YEARFULL}/${planet}.bz2 ]
-then
- echo $planet
- if [ -f /store/planet/pbf/${planet}.pbf ];
- then
- echo Error: file /store/planet/pbf/${planet}.pbf exists
- exit 1
- fi
- JAVACMD_OPTIONS=-Xmx2048M
- export JAVACMD_OPTIONS
- pbzip2 -dc /store/planet/planet/${YEARFULL}/${planet}.bz2 | osmosis --read-xml - --buffer bufferCapacity=18000 --write-pbf /store/planet/pbf/${planet}.pbf
- cd /store/planet/pbf/
- md5sum ${planet}.pbf >${planet}.pbf.md5
- ln -fs ${planet}.pbf planet-latest.osm.pbf
- ln -fs ${planet}.pbf.md5 planet-latest.osm.pbf.md5
-else
- echo Error no file - ${planet}.bz2
-fi
-
-rm /tmp/planet2pbf.lock
-