1

I've got a batch job that I want to run in google compute engine on a NetBSD instance. I expected that I could just shutdown -hp now at the end of the job and the instance would be powered off. But when I do that it still remains in the running state according to the google cloud console and CLI. How do I make a NetBSD virtual machine in google cloud shut itself off when it's no longer needed?

Note: Google cloud SDK is not available on NetBSD

Lawrence D'Anna
  • 2,998
  • 2
  • 22
  • 25

1 Answers1

2

Normally the command line option -p will power off the virtual machine. This indicates that there is an issue/bug with the underlying ACPI code that invokes the ACPI function.

As a workaround use the Google Cloud SDK gcloud command. This command has the added benefit that Google Cloud will force a power off if the instance does not shutdown normally.

Add this command to your script. You may need to install the CLI first.

gcloud compute instances stop INSTANCE_NAME

Another option is to write a program that implements the Google Cloud API to stop the instance. There are examples in most languages including Go and Python. You do not even need the SDK as you can call the REST API endpoint with an Access Token.

John Hanley
  • 74,467
  • 6
  • 95
  • 159