]> git.openstreetmap.org Git - chef.git/blob - cookbooks/tilelog/templates/default/tilelog.erb
Merge remote-tracking branch 'github/pull/56'
[chef.git] / cookbooks / tilelog / templates / default / tilelog.erb
1 #!/bin/sh
2
3 ANALYZE=<%= @analyze_bin %>
4 LOGDIR=<%= @input_dir %>
5 OUTDIR=<%= @output_dir %>
6 if [ -z "$DATE" ]; then
7                 DATE=`date -d "1 day ago" "+%Y-%m-%d"`
8 fi
9 TMPDIR=`mktemp -d -t tmp.XXXXXXXXX`
10 ORIGDIR=`pwd`
11
12 clean_up() {
13                 cd $ORIGDIR
14                 rm -rf $TMPDIR
15 }
16
17 trap clean_up 0 HUP INT TERM
18 cd $TMPDIR
19
20 mkdir db
21 nice -n 19 $ANALYZE $LOGDIR/*-${DATE}.xz > analyze.log
22 if [ -f tiles.txt ]; then
23                 nice -n 19 xz -9e -z tiles.txt
24                 mv tiles.txt.xz $OUTDIR/tiles-${DATE}.txt.xz
25
26 else
27                 cat analyze.log
28 fi