Course Home | Syllabus | Schedule | Readings | Downloads | Submissions | [print]

IT 3110: Systems Automation

Shell Scripting 4

Assignment

This assignment will hone your skills as a Bash shell programmer.

Tasks

Create the following script:

A script which automates the creation of an NFS share (mkdir), puts the correct entries in /etc/exports, and then mounts that share on all clients. Your script should also reverse this process if the user so chooses.

You should have your script automatically add a line to /etc/fstab for these mounts.

A sample run of your script might look like this:

    ./script.sh <sharename> <mountpoint> <option>
./script.sh /shares/fruit  /nfs/fruit  1

The option on the line above indicates that the script should create these shares. If the option is zero, it should delete the shares. You could optionally choose to ask the user for a selected option i.e. (Would you like to create? (y/n)) and then perform the options that they have selected.

Thus, your script would automatically create the /shares/fruit directory on your nfs server (if it didn’t already exist). Or create whatever sharename was passed into the script. Then it will need to add a line to /etc/exports. Then it may need to run exportfs -a to make that new nfs share visible to clients. Then your script would ssh to all your machines and create the new mountpoint like /nfs/fruit, and mount your share.

Report

Take a print screen of your scripts running. Also upload your scripts.

Submission

Last Updated 02/22/2021