Last active
September 7, 2017 09:17
-
-
Save OguzPastirmaci/eb79cf9f93827a3a2322 to your computer and use it in GitHub Desktop.
Bash script that shows a menu to start or stop VMs using Azure cross-platfom CLI
This file contains 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
#!/bin/bash | |
clear | |
echo "" | |
echo "-----------------------------------" | |
echo "" | |
echo "WHAT DO YOU WANT TO DO TODAY?" | |
echo "" | |
echo "1 - Start all the VMs" | |
echo "2 - Shutdown all the VMs" | |
echo "" | |
echo "0 - Exit" | |
echo "" | |
echo "-----------------------------------" | |
echo "" | |
echo -n "Enter selection: " | |
read selection | |
echo "" | |
case $selection in | |
1) azure vm list | grep "Stopped" | awk '{system("azure vm start "$2)}' ;; | |
2) azure vm list | grep "ReadyRole" | awk '{system("azure vm shutdown "$2)}' ;; | |
0) exit ;; | |
*) echo "Please enter 1, 2, or 0" | |
esac | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment