terraform-google-modules / terraform-google-startup-scripts

Provides a library of useful startup scripts to embed in VMs
https://registry.terraform.io/modules/terraform-google-modules/startup-scripts/google
Apache License 2.0
73 stars 36 forks source link

how to debug a startup script #30

Closed iamjenechka closed 4 years ago

iamjenechka commented 4 years ago

Any idea how to debug execution of a startup script?

I already tried

exec 5> >(systemd-cat -t $0)
BASH_XTRACEFD="5"
PS4='$LINENO: '
set -x

without any success

morgante commented 4 years ago

You can check the syslog for details.

Or SSH into the VM and re-excute the script: https://cloud.google.com/compute/docs/startupscript#rerunthescript

iamjenechka commented 4 years ago

I forgot to say, that I already checked journalctl and found nothing.

I'll try the the second thing. Thanks.

iamjenechka commented 4 years ago

google_metadata_script_runner --script-type startup --debug works just fine