#cloud-config ssh_import_id: [smoser] sm_misc: - &enable_rc_local_message | f=/usr/local/bin/rc-local-message [ -f "$f" ] || cat > "$f" <<"EOF" #!/bin/sh me="${0##*/}" marker="/$me.mark" set -f set_consoles() { local cmdline="" tok="" CONSOLES="" read cmdline > "$c" done } cat /proc/uptime > "/run/$me" if [ ! -f "$marker" ]; then echo "0" > "$marker" fi read num < $marker num=$(($num+1)) echo $num > "$marker" msg ====== successfull boot $num ======= EOF chmod 755 "$f" # make rc.local run it for us if ! grep -q "$f" /etc/rc.local; then sed -i '${/^exit 0$/d}' /etc/rc.local echo $f >> /etc/rc.local fi bootcmd: - [sh, -c, *enable_rc_local_message ]