A shell script for VM administration
Some tasks are complicated to do from the command line, simply because we have a lot of commands that we have to repeat over and over again and then reuse the values that we got in one step in the step that follows it.
In this recipe, we are going to deal with such a task, doing basic maintenance on a VM. What we plan to do is create a script that will enable the user to do a couple of standard tasks on VMs running on the local server, simplifying administration tasks and removing the need to remember long commands. Our plan is to enable the user to start, stop, check status, and revert a VM running on the local server. The script is going to provide the user with the list of machines and give them the opportunity to choose any available machines or apply the command to all of them.
Let's see what is needed for this task.
Getting ready
By this point, you have become accustomed to our disclaimers and requirements that we have...