#!/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-main } 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 $? }