Changes

Jump to: navigation, search

OSL740 Lab 4

22 bytes removed, 15:56, 21 July 2023
m
Protected "OSL740 Lab 4": OER transfer ([Edit=Allow only administrators] (indefinite) [Move=Allow only administrators] (indefinite))
<li>Log out from '''osl740_1''' and log back in as your normal user.</li>
<li>Create a file called '''osl740_1''' in '''/etc/sudoers.d'''. Add the following line to it:
<b><code><span style="color:#3366CC;font-size:1.2em;">oosl740_1 osl740_1 ALL=(ALL) /usr/bin/systemctl</span></code></b>
::This indicates this user can use sudo to run systemctl commands as if they were any account (root is the important one).
</li>
<li>Add a second parser.add_argument line to your script so that you can also obtain the name of the directory to archive from the command line. You can choose if it should go before or after the name of the archive. Just remember to use a different argument name, and an appropriate help message.</li>
<li>Replace the line in your script that prompts the user for the name of the directory with code that will retrieve the value the user entered on the command line.</li>
<li>Run you your script to make sure it works.<br />
You should now be able to enter both the directory to archive, and the name of the resulting archive on the command line, and should only be prompted about compression.</li>
<li>All that is left to finish the script is to replace the prompts for compression with command line options. You could do this by adding a third argument and requiring it to include a compression type, or by creating a mutually exclusive group with three arguments in it (one for each compression type). Neither of these is more '''correct''' than the other. Pick which one you would like to try and finish the script with it.</li>
# Make certain that your '''c7host''', '''centos1''' and '''centos2''' VMs are running.
# Switch to your '''c7host''' VM.
# Open a shell terminal, enter a root session, and change to your '''bin''' directory.
# Issue the Linux command: <b><code><span style="color:#3366CC;font-size:1.2em;">wget https://osl740.github.io/labs/lab4-check.bash</span></code></b>
# Give the '''lab4-check.bash''' file execute permissions (for the file owner).

Navigation menu