alpine-overlay/kubezero/zdt-base/cloudbender.init

49 lines
1.1 KiB
Bash
Executable File

#!/sbin/openrc-run
# vim:set ts=8 noet ft=sh:
#
description="CloudBender - mount additional volumes, send shutdown messages"
depend() {
need net
before sshd
after tiny-cloud
}
start() {
source /usr/lib/cloudbender/init.sh
source /usr/lib/cloudbender/base.sh
source /usr/lib/cloudbender/volumes.sh
get_meta_data
# mount extra volumes as early as possible
[ -n "$VOLUMES" ] && mount_volumes "$VOLUMES"
# allow optional ssh keys, eg. via IAM for AWS
cb_sshkeys
eend $?
}
stop() {
source /usr/lib/cloudbender/init.sh
source /usr/lib/cloudbender/base.sh
source /usr/lib/cloudbender/volumes.sh
get_meta_data
[ -n "$VOLUMES" ] && unmount_volumes "$VOLUMES"
# Include dynamic config setting create at boot
[ -r /etc/cloudbender/rc.conf ] && . /etc/cloudbender/rc.conf
[ -n "$DEBUG" ] && [ -r /tmp/shutdown.log ] && SHUTDOWNLOG="$(cat /tmp/shutdown.log)"
[ -n "$RC_REBOOT" ] && ACTION="rebooting" || ACTION="terminated"
[ -z "$DISABLE_SCALING_EVENTS" ] && /var/lib/cloudbender/sns_alarm.sh "Instance $ACTION" "" Info "$SHUTDOWNLOG"
eend $?
}