Open main menu

CDOT Wiki β

Changes

OPS235 Lab 2 - CentOS7

1,509 bytes added, 20:10, 2 April 2015
no edit summary
|}
You will continue our use of Bash Shell scripting by first creating a Bash Shell script that will allow the Linux sysadmin to select their created VMs for backup to root's home directory. Afterwards you will download, view and run a couple Bash Shell scripts that use the virsh command to start and stop your virtual machines.
We continue the discussion of using # Open a Bash shell terminal and login as root.# Use a text editor (such as <b><code><span style="color:#3366CC;font-size:1.2em;">vi</span></code></b> or <b><code><span style="color:#3366CC;font-size:1.2em;">nano</span></code></b>) to create a Bash Shell Scripts script called: <b><code><span style="color:#3366CC;font-size:1.2em;">backupVM.bash</span></code></b> in /root's home directory.# Enter the following text content into your text-editing session:<code style="color:#3366CC;font-family:courier;font-size:.9em;margin-left:20px;"><br>::&#35;!/bin/bash # Forces script to help automate routine tasks for run in the Linux bash shell::::::&#35; Author: *** INSERT YOUR NAME ***::&#35; Date: *** CURRENT DATE ***::&#35;::&#35; backupVM.bash::&#35; Purpose: Creates system administratorinfo report::&#35;<br>&#35; USAGE: ./report.bash::::::if [ $HOME != "root" ] # only runs if logged in as root::then<br>&nbsp;echo "You must be logged in as root. In lab1" >&2::&nbsp;exit 1::fi</code><br><ol><li value="4">Save your editing session, assign your report.bash file read and execute permissions (at least for the owner) and run by typing: <b><code><span style="color:#3366CC;font-size:1.2em;">./report.bash</span></code></b></li><li>Did it run? If not what do you think you were exposed need to do in order to downloading and running run the Bash Shell Scripts for demonstration purposesScript?</li><li>Issue the command <b><code><span style="color:#3366CC;font-size:1. Before showing you demos for this lab, you should learn a few more 2em;">su</span></code></b> and run the Bash shell scripting tricks" in case you need to create again. Did it work?</li><li>Reopen your own set of tools text-editing session for task automationreport.bash and add the following lines of code to the bottom of the shell script file:</ol>
13,420
edits