Identifying a Linode restored from a backup
I have a service on my Linode that runs every 5 minutes and sends out e-mails/text alerts.
This is automatically enabled on boot so normal reboots don’t cause it to stop running.
If I clone my Linode from a backup (testing upgrades, restore-ability etc.) and boot the clone, the service will start sending out from the clone and potentially cause duplicate e-mails/texts to be sent.
Is there a way to identify on boot if the Linode has been cloned? Something like getting the Linode ID, and comparing it to the ID from the previous boot - allowing the service to not start on the first boot and give me chance to login and disable it.
If not right now, could this be a possibility in the forthcoming metadata service?
Or is there a way to run a StackScript on a restored Linode, so I can a script to disable the services post-restore?
The only other way I could think of to achieve this is to have a firewall that blocks all outbound access, and assign the cloned Linode to that first, then boot it and use Lish to disable the services before re-instating network access.
This however is a step to remember before booting the clone so could easily be forgotten.
The only thing I can think of is to write a script that you run locally (from your PC or or from another Linode) to restore the backup using the API. After the restoration is done, you use another API call to give the restored Linode a special tag.
You can't use the API to create a backup…only a snapshot.
When the Linode is booted, it uses the API to look for the tag and do whatever special thing you need done if the tag is present.
I have no idea if this meets your needs…like pulling a rabbit out of a hat ;-)