Page MenuHomePhabricator

T266483 run

Authored By
Kormat
Nov 5 2020, 9:49 AM
Size
1 KB
Referenced Files
None
Subscribers
None

T266483 run

#!/bin/bash
set -euo pipefail
IGNORE_REPLICAS=${IGNORE_REPLICAS:-}
service_suffix() {
if echo $inst | grep -q :; then
echo @$section;
fi
}
section=$1; shift
dc=$1; shift
for fqdn in $(nodelist "(A:db-section-$section and A:$dc) and not A:db-store"); do
inst=$(host-to-instance $fqdn $section)
echo "====> $inst"
rep_host=$(sudo -H mysql.py -h $inst -BN -e 'select @@report_host')
if [ "$rep_host" == "$fqdn" ]; then
echo "Already done"
continue
fi
if [ -z "$IGNORE_REPLICAS" ]; then
if [ -n "$(sudo -H mysql.py -h $inst -BN -e 'show slave hosts')" ]; then
echo "Not touching, has replicas"
continue
fi
fi
SSH_AUTH_SOCK=/run/keyholder/proxy.sock ssh root@$fqdn systemctl restart mariadb$(service_suffix)
SSH_AUTH_SOCK=/run/keyholder/proxy.sock ssh root@$fqdn systemctl restart prometheus-mysqld-exporter$(service_suffix)
if [ -n "$(sudo -H mysql.py -h $inst -BN -e 'show slave status')" ]; then
sudo -H mysql.py -h $inst -e 'start slave'
fi
done

File Metadata

Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8610803
Default Alt Text
T266483 run (1 KB)

Event Timeline