initial
This commit is contained in:
22
rootfs/events/execs/includes/anotate_event_processing.sh
Executable file
22
rootfs/events/execs/includes/anotate_event_processing.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
header="[REPMGR EVENT::$2]"
|
||||
export header
|
||||
echo "$header Node id: $1; Event type: $2; Success [1|0]: $3; Time: $4; Details: $5"
|
||||
|
||||
if [[ $3 -ne 1 ]];then
|
||||
echo "$header The event failed! No need to do anything."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ $1 -ne $(repmgr_get_node_id) ]]; then
|
||||
echo "$header The event did not happen on me! No need to do anything."
|
||||
exit 1
|
||||
fi
|
||||
12
rootfs/events/execs/includes/lock_primary.sh
Executable file
12
rootfs/events/execs/includes/lock_primary.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
echo "$header Locking primary..."
|
||||
echo "$4" >> "$REPMGR_PRIMARY_ROLE_LOCK_FILE_NAME"
|
||||
16
rootfs/events/execs/includes/lock_standby.sh
Executable file
16
rootfs/events/execs/includes/lock_standby.sh
Executable file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
query="SELECT upstream_node_id FROM repmgr.nodes WHERE node_id=$(repmgr_get_node_id)"
|
||||
new_upstream_node_id="$(echo "$query" | BITNAMI_DEBUG=true postgresql_execute "$REPMGR_DATABASE" "$POSTGRESQL_REPLICATION_USER" "$POSTGRESQL_REPLICATION_PASSWORD" "" "" "-tA")"
|
||||
if [[ -n "$new_upstream_node_id" ]]; then
|
||||
# shellcheck disable=SC2154
|
||||
echo "$header Locking standby (new_upstream_node_id=$new_upstream_node_id)..."
|
||||
echo "$new_upstream_node_id" > "$REPMGR_STANDBY_ROLE_LOCK_FILE_NAME"
|
||||
fi
|
||||
12
rootfs/events/execs/includes/unlock_primary.sh
Executable file
12
rootfs/events/execs/includes/unlock_primary.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
echo "$header Unlocking primary..."
|
||||
rm -f "$REPMGR_PRIMARY_ROLE_LOCK_FILE_NAME"
|
||||
12
rootfs/events/execs/includes/unlock_standby.sh
Executable file
12
rootfs/events/execs/includes/unlock_standby.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
# Copyright Broadcom, Inc. All Rights Reserved.
|
||||
# SPDX-License-Identifier: APACHE-2.0
|
||||
|
||||
set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
# set -o xtrace # Uncomment this line for debugging purposes
|
||||
|
||||
# shellcheck disable=SC2154
|
||||
echo "$header Unlocking standby..."
|
||||
rm -f "$REPMGR_STANDBY_ROLE_LOCK_FILE_NAME"
|
||||
Reference in New Issue
Block a user