mysqld-need-start.sh.in 990 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
#!{{ bash_bin }}

curl () {
  {{ curl_bin }} -k --silent -H "Accept: application/json" "$@"
}

# TOKEN=$(curl -s -X POST --data '{"username":"{{ username }}","password":"XXXXX"}' {{ repman_url }}/api/login | {{ jq_bin }} -r '.token')

# Checking if mariadb start is needed
#CODE=$(curl -H "Authorization: Bearer ${TOKEN}" -o /dev/null -w "%{http_code}" {{ repman_url }}/api/clusters/{{ cluster }}/servers/{{ db_host }}/{{ db_port }}/need-start)
CODE=$(curl -o /dev/null -w "%{http_code}" {{ repman_url }}/api/clusters/{{ cluster }}/servers/{{ db_host }}/{{ db_port }}/need-start)

if [ $CODE -eq 200 ]; then
14 15 16
  echo "$CODE: Updating mysql configuration..."
  # update mysql configuration
  {{ update_config }}
17 18 19 20 21 22 23 24
  echo "$CODE: Starting mariadb service..."
  # print current status, can be useful for debug...
  {{ mariadb_controller }} status mariadb
  {{ mariadb_controller }} start mariadb
  sleep 5
  # check again if the service is still up...
  {{ mariadb_controller }} status mariadb
fi