Skip to content

Instantly share code, notes, and snippets.

View tahaozket's full-sized avatar
:bowtie:
Having fun

Taha Ozket tahaozket

:bowtie:
Having fun
View GitHub Profile
# install parallel first (sudo apt-get install -y parallel)
JOB_NUM=10
NAME_FILTER='*'
# stop instances
gcloud compute instances list --filter=name:$NAME_FILTER | awk '/RUNNING/ {printf "gcloud -q compute instances stop %s --zone %s;\n", $1, $2 > "stop-instances.txt" }'
parallel --jobs $JOB_NUM < stop-instances.txt
# remove delete protection