summaryrefslogtreecommitdiffstats
path: root/modules/tozt/files/metabase
blob: 7b71430409e2159683fc212c4f0b8f77d9e65fbd (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/sh
set -eu

tmp="$(mktemp --tmpdir -d metabase-cron.XXXXXXXXXX)"

cleanup() {
    if perl -e'exit 1 unless $ARGV[0] =~ m{^/tmp/metabase-cron.*$}' "$tmp"; then
        rm -rf "$tmp"
    fi
}
trap cleanup EXIT

chown doy:doy "$tmp"
cd "$tmp"

# shellcheck disable=SC2046
su doy /home/doy/coding/metabase-utils/bin/load $(cat /home/doy/.config/google/investments-sheet) > /dev/null