#!/bin/bash state=$(nc 127.0.0.1 5400) if [[ "$state" != "MASTER" ]]; then /usr/local/sbin/pg_backup -c /etc/postgresql/9.6/main/pg_backup.config fi