Changes

Jump to: navigation, search

OPS245 Lab 1

27 bytes removed, 12:57, 1 June 2021
Updates links to OPS245 share.
<br>
<ol><li value="15">Save, run the script, and view the ''report.txt'' contents (are you using tip that was given to save time?).</li><li>Edit the shell script and include output from the <b><code><span style="color:#3366CC;font-size:1.2em;">ps aux</span></code></b> and <b><code><span style="color:#3366CC;font-size:1.2em;">ip address show</span></code></b> commands (with appropriate titles). Remember to redirect that output to add to the bottom of the file!</li><li>Save, run and confirm that the shell script is working correctly.</li><li>What would be the use of keeping this shell script as a Linux system administrator?</li></ol>
<ol><li value="19">Here are some more "complex" Bash Shell scripts, that perform the same task. Although you are not required to understand some of these other tricks, it is recommended that you view the contents of the scripts and save them for future consideration or examples.</li><li>The <b><code>wget</code></b> command can be used to quickly download files from the Internet. Issue the following command:<br><b><code><span style="pointer-events: none;cursor: default;color:#3366CC;font-size:1.2em;">wget https://ict.senecacollege.ca/~peter.callaghan/ops245/labslab1/text-report.bash</span></code></b></li><li>Verify that the file '''text-report.bash''' was downloaded to your current directory.</li><li>Assign read and execute permissions for this file by issuing the command: <b><code><span style="color:#3366CC;font-size:1.2em;">chmod u+rx text-report.bash</span></code></b></li><li>Run this Bash Shell script by issuing the command: <b><code><span style="color:#3366CC;font-size:1.2em;">./text-report.bash</span></code></b></li><li>Check to see if it created a report in your current directory. What is the purpose of the report?</li><li>Use the <b>vi</b> text editor to view the contents of the file <b>text-report.bash</b>. Can you understand how this script works?<br><br></li><li>Use the <b><code>wget</code></b> command to download, study, and run the following shell scripts on-line:<br><b><code><span style=" pointer-events:none;cursor:default;color:#3366CC;font-size:1.2em;">https://ict.senecacollege.ca/~ops235ops245/labslab1/report.bash<br>&nbsp;https://ict.senecacollege.ca/~ops235ops245/labslab1/report3.bash</span></code></b><br><br></li><li>Try to understand what these Bash Shell scripts do.</li></ol>
'''Answer Investigation 3 observations (all parts and questions) in your lab log book.'''
<li>Install python3 on your Centos Host machine.</li>
<li><ul><li>Create a new file in your ~/bin directory called '''myreport.py'''</li>
<li>Since we haven't covered if statements in python yet, we won't be able to check if the user running the script is root. For now, we will have to trust ourselves to remember to use elevated permisisons permissions to run this script. We will correct this in lab 2.</li>
</ul></li>
<li>Populate the beginning of the file with sh-bang line and block comment equivlent equivalent to what was in '''myreport.bash'''
<br>
<pre style="color:#3366CC;font-family:courier;font-size:.9em;margin-left:20px;>
# Make certain that your '''c7host''' VM is running, open the Bash Shell terminal.<br><br>
# Change to the '''~/bin''' directory.<br><br>
#Download the checking script by issuing the following Linux command:<br><b><code><span style="color:#3366CC;font-size:1.2em;">wget https://ict.senecacollege.ca/~peter.callaghan/ops245/labslabcheck/lab1-check.bash</span></code></b><br><br>
# Give that downloaded shell script file execute permissions (for the file owner).<br><br>
# Run the shell script using sudo and if there are any warnings, make fixes and re-run shell script until you receive a "congratulations" message.<br><br>

Navigation menu