forked from ansible/metrics-utility
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun-ccsp2-gather
More file actions
executable file
·41 lines (31 loc) · 1.06 KB
/
run-ccsp2-gather
File metadata and controls
executable file
·41 lines (31 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/sh
set -e
cd "`dirname "$0"`"
export METRICS_UTILITY_SHIP_PATH="./out"
export METRICS_UTILITY_SHIP_TARGET="directory"
TIME=`command -v gtime >/dev/null 2>&1 && echo 'gtime' || echo '/usr/bin/time'`
SCHEMA=`realpath "tools/docker/latest.sql"`
ROLES=`realpath "tools/docker/roles.sql"`
NAME=ccsp2-gather-`basename "$SCHEMA" .sql`
echo "$NAME"
pg_isready -h localhost ||
podman run --name "$NAME" --replace \
-e POSTGRES_USER="myuser" \
-e POSTGRES_PASSWORD="mypassword" \
-e POSTGRES_DB="awx" \
-v "$ROLES":/docker-entrypoint-initdb.d/init-roles.sql:ro \
-v "$SCHEMA":/docker-entrypoint-initdb.d/init-schema.sql:ro \
-p 5432:5432 \
-d mirror.gcr.io/postgres
tries=5
until pg_isready -h localhost; do
[ "$tries" -lt 1 ] && break
echo "Waiting for PostgreSQL to be ready...($tries)"
sleep "$tries"
tries=`expr "$tries" - 1`
done
$TIME --format='\n\nmemory %MK\ncpu %P\ntime %es\n\n' \
uv run ./manage.py gather_automation_controller_billing_data --ship --until=10m --force "$@"
podman stop "$NAME"
set -x
ls -lR out/data/`date +%Y`/