Files
spinifex/scripts/images/rds-postgres/rds-datadir.initd
T

31 lines
931 B
Plaintext

#!/sbin/openrc-run
# rds-datadir — boot oneshot that discovers the hot-plugged data volume, formats
# it if authorized, and mounts it at the datadir mount point. It runs after the
# agent has written the authenticated handoff and before anything can use the
# PostgreSQL datadir. Soft ordering keeps a failed boot visible on the console.
description="Spinifex RDS data volume mount"
AGENT_ENV="/etc/spinifex-rds/agent.env"
depend() {
after localmount rds-agent
before rds-init postgresql
}
start_pre() {
if [ -f "${AGENT_ENV}" ]; then
# shellcheck disable=SC1090
. "${AGENT_ENV}"
export RDS_HANDOFF_DIR RDS_DATA_MOUNT
fi
}
start() {
ebegin "Mounting the RDS data volume"
# To the console for the same reason rds-init's is: the serial log is the
# only view of a boot that failed before the engine came up.
/usr/local/sbin/rds-datadir > /dev/console 2>&1
eend $?
}