Skip to content

Instantly share code, notes, and snippets.

@thewisenerd
Created April 29, 2017 10:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thewisenerd/90dc46c2cf83a98d275f903583d9a7ab to your computer and use it in GitHub Desktop.
Save thewisenerd/90dc46c2cf83a98d275f903583d9a7ab to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
function check_user {
if who | grep -v tmux | grep -wq $1; then
exit
fi
}
users=( user1 user2 user3 )
for user in ${users[@]} ; do
check_user $user
done
echo "no usrs, shut this down!"
gcloud compute instances stop --zone "zone" --quiet "build-machine"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment