]> git.openstreetmap.org Git - chef.git/blob - cookbooks/tilelog/templates/default/tilelog.erb
Update promscale to 0.14.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
22 nice -n 19 /opt/tilelog/bin/tilelog --date "${DATE}" --generate-success \
23   --tile "${TILEFILE}" --host "${HOSTFILE}" --app "${APPFILE}"
24
25 mv "${TILEFILE}" "${HOSTFILE}" "${APPFILE}" "${OUTDIR}"
26
27 rm -rf "$TMPDIR"