Open main menu

CDOT Wiki β

Changes

OPS235 Lab 2 - CentOS7

212 bytes added, 07:49, 28 March 2015
no edit summary
==Part 1: Automating Routine Tasks (Shell Scripting)==
[[Image:lab2_text_1.png|thumb|right|275px|When executed as '''root''' or using '''sudo''' command, provides VM status and opportunity to '''start''' VMs in a text-based interface]]
#You may have learned about creating We continue the discussion of using Bash Shell Scripts to help automate routine tasks for the Linux system administrator. In lab1, you were exposed to downloading and running Bash Shell Scripts for demonstration purposes. Before showing you demos for this lab, you should learn a few more "shell scripting tricks" in case you need to create your ULI101 courseown set of tools for task automation. Shell scripts help Linux users and system administrators   #Click on the following link to automatic repetitive tasks run an online tutorial showing you some additional shell scripting techniques: [ link ].#It is recommended to become more efficient and to help them save timepractice creating Bash Shell Scripts as you proceed throughout this course.#The <b><code>wget</code></b> command can be used to quickly download files from the InternetLet's look at some demos involving managing VMs with shell scripts. Issue the following command:<blockquote><b><code><span style="pointer-events: none;cursor: default;color:#3366CC;">wget https://scs.senecac.on.ca/~murrayelizabeth.saulkopiec/text-reportbackupVM.bash</span></code></b></blockquote>#Set the appropriate permissions and run this Bash Shell script.#Verify that the file '''text-report.bash''' was downloaded backup of your virtual machine occurred (hint: issue ls command to your current directoryverify the date and time of creation).#Assign read and execute permissions for this file by issuing Use the command: <b><code>chmod u+rx text-report.bashwget</code></b>#Run this Bash Shell script by issuing command to download, study, and run the commandfollowing shell scripts on-line: <blockquote><b><code><span style=" pointer-events:none;cursor:default;color:#3366CC;">https://scs.senecac.on.ca/~murray.saul/vm-start-text-report.bash<br>https:/code></b>#Check to see if it created a report in your current directoryscs.senecac.on.ca/~murray. What is the purpose of the report?#Use the <b>vi<saul/b> text editor to view the contents of the file <b>vm-stop-text-report.bash</b>. Can you understand how this script works?<br><brspan>#Use the <b><code>wget</code></b> command to download, study, and run the following shell scripts on-line:<blockquote><b><code><span style=" pointer-events:none;cursor:default;color:#3366CC;">https://scs.senecac.on.ca/~murray.saul/reportvm-start.bash<br>https://scs.senecac.on.ca/~murray.saul/report3vm-stop.bash</span></code></b></blockquote>
#Try to understand what these Bash Shell scripts do.
#You have completed lab1lab2. Proceed to Completing The Lab, and follow the instructions for "lab sign-off".
'''Answer the Investigation 3 observations / questions in your lab log book.'''
13,420
edits