There are 4 ways in which you can add a start up script to your VM
In this video i will explain the second 2 ways
1. Gcloud Command
2 using the metadata tag startup-script-url
For Part 1: Please refer
• Part 1 .How to add a start up script ...
Also
For restarting a start up script use
sudo journalctl -u google-startup-scripts.service
For seeing the logs
sudo google_metadata_script_runner startup
For more information please refer
https://cloud.google.com/compute/docs...