]> git.openstreetmap.org Git - chef.git/blob - cookbooks/tilelog/templates/default/tilelog.erb
Update to tilelog v1.5.0
[chef.git] / cookbooks / tilelog / templates / default / tilelog.erb
1 #!/bin/sh
2 set -e
3
4 if [ -z "$DATE" ]
5 then
6   DATE=$(date -u -d "1 day ago" "+%Y-%m-%d")
7 fi
8
9 OUTDIR="<%= @output_dir %>"
10 TMPDIR=$(mktemp -d -t tilelog.XXXXXXXXX)
11
12 cd "$TMPDIR"
13
14 export AWS_ACCESS_KEY_ID="AKIASQUXHPE7JFCFMOUP"
15 export AWS_SECRET_ACCESS_KEY="<%= @aws_key %>"
16 export AWS_REGION="eu-west-1"
17
18 TILEFILE="tiles-${DATE}.txt.xz"
19 HOSTFILE="hosts-${DATE}.csv"
20 APPFILE="apps-${DATE}.csv"
21 COUNTRYFILE="countries-${DATE}.csv"
22
23 nice -n 19 /opt/tilelog/bin/tilelog --date "${DATE}" --generate-success \
24   --tile "${TILEFILE}" --host "${HOSTFILE}" --app "${APPFILE}" --country "${COUNTRYFILE}"
25
26 mv "${TILEFILE}" "${HOSTFILE}" "${APPFILE}" "${COUNTRYFILE}" "${OUTDIR}"
27
28 rm -rf "$TMPDIR"