2023-04-26 17:22:52 +00:00
|
|
|
#!/sbin/openrc-run
|
|
|
|
# vim:set ts=8 noet ft=sh:
|
|
|
|
#
|
|
|
|
|
|
|
|
description="CloudBender - mount additional volumes, send shutdown messages"
|
|
|
|
|
|
|
|
depend() {
|
|
|
|
need net
|
|
|
|
before sshd
|
2023-07-04 15:10:30 +00:00
|
|
|
after tiny-cloud-main
|
2023-04-26 17:22:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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 $?
|
|
|
|
}
|