Created
March 15, 2020 16:29
-
-
Save agmm/56bf1ea3a4cace6f3bcdb213f2faa483 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
machine="machine-name" | |
echo "Starting gcloud VM" | |
OUTPUT="$(gcloud compute instances start "${machine}" --format="json")" | |
ip="$(echo "$OUTPUT" | grep natIP | grep -E -o "([0-9]{1,3}[\.]){3}[0-9]{1,3}")" | |
echo "----------" | |
echo "VM Name: ${machine}" | |
echo "VM External IP: ${ip}" | |
echo "----------" | |
echo "Waiting 30 seconds before starting server" | |
sleep 30 | |
echo "Creating sshcode server on the remote machine" | |
./sshcode user@"${ip}" | |
echo "Stopping gcloud VM" | |
gcloud compute instances stop "${machine}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment