I mentioned on my last question that I found out all the relevant log file locations and commands here: https://cloud.google.com/compute/docs/startupscript#rerunthescript
My situation:
Startup script literally starts with "exit 69" for testing purposes.
Commands I run:
sudo google_metadata_script_runner --script-type startup
echo $?
Output:
0
Relevant contents of /var/log/daemon.log
(repeating):
Sep 19 15:15:32 api-0 startup-script: INFO Starting startup scripts.
Sep 19 15:15:32 api-0 startup-script: INFO Found startup-script in metadata.
Sep 19 15:15:32 api-0 startup-script: INFO startup-script: Return code 69.
Sep 19 15:15:32 api-0 startup-script: INFO Finished running startup scripts.
Is there a good way to get the return code in my script without parsing /var/log/daemon.log
and hoping that it actually ended up there and that I won't grab the wrong one?