Suppose, I have requirement to run startup scripts only on first boot of the vm. My vm can start/stop frequently and I don't want to run script in every boot. As per GCP doc startup scripts runs every time your instance boots up.
Suppose, I have requirement to run startup scripts only on first boot of the vm. My vm can start/stop frequently and I don't want to run script in every boot. As per GCP doc startup scripts runs every time your instance boots up.
Startup scripts run on each boot. There is no "run once" setting/option.
I recommend setting a flag, such as a file on disk after a script runs. Then check for the existence of this flag at the start of your script and exit if it exists.