pilogo
pilogo

Reputation: 85

gcloud ssh jobs when internet in interrupted

I'm using google cloud instance for one of my long duration job and using : gcloud compute ssh 'instance name' to connect from one of my ubuntu PC terminal.

All goes well. But as the job takes few hours to complete and when my PC is out of network the shell gets killed and hence the job also.

I'm wondering if there is a way by which the job can continue on google cloud when the 'SSH terminal' from my PC gets killed because on network unavailability?

Thanks

Upvotes: 1

Views: 302

Answers (1)

Tom Rini
Tom Rini

Reputation: 2173

The best answer here is to use mosh to connect to your instance. In order to do this, you will need to first install mosh on your instance via the normal method for your distribution. Second you will need to modify the firewall that Google runs to allow for the required UDP port to reach:

you@local-pc:~$ gcloud compute firewall-rules create default-allow-mosh --allow=udp:60001

In this case we use the name 'default-allow-mosh' following the nomenclature used in the rest of the firewall rules of network-action-what and telling it to allow the UDP port that mosh says it must have allowed through.

Upvotes: 1

Related Questions