051-check-azure-master-is-standby.sh 353 Bytes
Newer Older
1 2 3 4
#!/bin/bash

set -eu

5
# shellcheck source=/dev/null
6 7
source "${BASE}/env_${ENVIRONMENT}"

Matteo Melli's avatar
Matteo Melli committed
8
if echo "select pg_is_in_recovery()" \
9
  | ssh_remote "$AZURE_MASTER" sudo -u gitlab-psql gitlab-psql -v ON_ERROR_STOP=1 -d postgres -t -A \
Matteo Melli's avatar
Matteo Melli committed
10
  | grep -q 't'
11 12
then
  echo "$AZURE_MASTER is standby"
Matteo Melli's avatar
Matteo Melli committed
13
  exit 0
14
else
Matteo Melli's avatar
Matteo Melli committed
15 16
  >&2 echo "$AZURE_MASTER is NOT standby"
  exit 1
17
fi