1
votes

I've set up startup scripts for all of my instances, so that when I reboot one, it updates itself to the latest version of whatever it's running. Now I want to do multiple of those via one script, one single button push. It works by just rebooting all relevant instances, but I want to see the output of the startup scripts.

From here: https://cloud.google.com/compute/docs/startupscript#rerunthescript - I've found out that, on Debian machines, triggering a startup script by itself without rebooting a machine is done via sudo google_metadata_script_runner --script-type startup, and that all output from the startup script goes to /var/log/daemon.log. Is there any way to set the startup scripts to output directly to stdout?

1
Not sure if it's useful, but most or all distributions also write the startup script output to the serial port (viewable from the web console and gcloud CLI). - ZachB

1 Answers

1
votes

As ZachB mentioned, startup scripts on Google Compute Engine will output to the serial port which you can view in the Cloud Console or on the command line with the gcloud tool. The following docs explain in more detail how to view the serial port output:

Interacting with the Serial Console
https://cloud.google.com/compute/docs/instances/interacting-with-serial-console

(Navigate to 'VM Instances' -> instance name -> 'Serial port' -> 'Connect to serial port')

gcloud compute instances get-serial-port-output
https://cloud.google.com/sdk/gcloud/reference/compute/instances/get-serial-port-output

gcloud compute instances get-serial-port-output NAME [--port=PORT] [--zone=ZONE] [GLOBAL-FLAG …]