Merge "Add fluentd client service"
[apex-tripleo-heat-templates.git] / extraconfig / tasks / pacemaker_resource_restart.sh
1 #!/bin/bash
2
3 set -eux
4
5 # Run if pacemaker is running, we're the bootstrap node,
6 # and we're updating the deployment (not creating).
7 if [[ -n $(pcmk_running) && -n $(is_bootstrap_node) ]]; then
8
9     TIMEOUT=600
10     SERVICES_TO_RESTART="$(ls /var/lib/tripleo/pacemaker-restarts)"
11     PCS_STATUS_OUTPUT="$(pcs status)"
12
13     for service in $SERVICES_TO_RESTART; do
14         if ! echo "$PCS_STATUS_OUTPUT" | grep $service; then
15             echo "Service $service not found as a pacemaker resource, cannot restart it."
16             exit 1
17         fi
18     done
19
20     for service in $SERVICES_TO_RESTART; do
21         echo "Restarting $service..."
22         pcs resource restart --wait=$TIMEOUT $service
23         rm -f /var/lib/tripleo/pacemaker-restarts/$service
24     done
25 fi