You can add the contents of a startup script directly to a VM when you create the VM.
You can also pass a Linux startup script directly to an existing VM:
In your Cloud Console go to VM Instance page and click on the instance you want to pass the start up script
Click Edit.
Under Automation, specify the following:
#! /bin/bash
shutdown -P +60
-P
Instructs the system to shut down and then power down.
The time argument specifies when to perform the shutdown operation.
The time can be formatted in different ways:
First, it can be an absolute time in the format hh:mm
, where hh
is the hour (1 or 2 digits, from 0 to 23) and mm
is the minute of the hour (in two digits).
Second, it can be in the format +m
, where m
is the number of minutes to wait.
Also, the word now
is the same as specifying +0
; it shuts the system down immediately.