Difference between revisions of "Scripting Compatibility for Current OPS235 labs: (Week-by-week)"
Line 10: | Line 10: | ||
{|cellpadding="15" width="100%" | {|cellpadding="15" width="100%" | ||
|- | |- | ||
− | |<blockquote><blockquote>'''Example of simple text-based report shell script Demo:''' [ [https://scs.senecac.on.ca/~murray.saul/text-report.bash text-report.bash] ]<br><br>Scripting Skills:<blockquote><ul><li>'''if''' statement</li><li>'''exit''' command</li><li>USER '''Environment Variable'''</li><li>'''redirection''' (both > and >>)</li><li>'''command substitution'''</li></ul></blockquote><br><br> | + | |<blockquote><blockquote>'''Example of simple text-based report shell script Demo:''' [ [https://scs.senecac.on.ca/~murray.saul/text-report.bash text-report.bash] ]<br><br>Scripting Skills:<blockquote><ul><li>'''if''' statement</li><li>'''exit''' command</li><li>USER '''Environment Variable'''</li><li>'''redirection''' (both > and >>)</li><li>'''command substitution'''</li></ul></blockquote><br><br>Scripting Skills Match: [ULI101] [OPS435]<br><br>'''Practical Consideration for scripting in lab1:''' Students create simple bash shell script, add elements, then have them copy and paste, then run this script. Key elements related to the script is evaluated and provides basis for other scripting tasks in other labs? Should midterm and/or final exam contain a scripting question? (recommended)<br><br></blockquote></blockquote> |
|[[Image:lab1-script-text-report.png|thumb|left|400px|When executed as '''root''' or using '''sudo''' command, script generates a basic text-based report in a file]] | |[[Image:lab1-script-text-report.png|thumb|left|400px|When executed as '''root''' or using '''sudo''' command, script generates a basic text-based report in a file]] | ||
|} | |} | ||
Line 16: | Line 16: | ||
{|cellpadding="15" width="100%" | {|cellpadding="15" width="100%" | ||
|- | |- | ||
− | |<blockquote><blockquote>'''Example of a graphical shell script Demo:<br>''' [ [https://scs.senecac.on.ca/~murray.saul/report.bash report.bash] ] (currently under construction - requires testing in CENTOS)<br><br>Listing of Scripting Skills from Demo Listed Above:<blockquote><ul><li>'''if''' statement</li><li>'''exit''' command</li><li>USER '''Environment Variable'''</li><li>'''redirection''' (both > and >>)</li><li>'''zenity'''</li><li>'''for''' loop</li><li>'''command substitution'''</li><li>'''sed'''</li><li>'''set''' command ('''positional parameters''')</li></ul></blockquote><br><br>Skills Match | + | |<blockquote><blockquote>'''Example of a graphical shell script Demo:<br>''' [ [https://scs.senecac.on.ca/~murray.saul/report.bash report.bash] ] (currently under construction - requires testing in CENTOS)<br><br>Listing of Scripting Skills from Demo Listed Above:<blockquote><ul><li>'''if''' statement</li><li>'''exit''' command</li><li>USER '''Environment Variable'''</li><li>'''redirection''' (both > and >>)</li><li>'''zenity'''</li><li>'''for''' loop</li><li>'''command substitution'''</li><li>'''sed'''</li><li>'''set''' command ('''positional parameters''')</li></ul></blockquote><br><br>'''Scripting Skills Match:''' [ULI101] [OPS435]<br><br>'''Practical Consideration for scripting in lab1:''' Students use '''wget''' to download existing shell script and run it to see what happens. Students are '''encouraged to view contents of more advanced shell script(s)''', to see where the commands are being used (from previous shell script), but are '''not required to understand more complex elements''' of these shell scripts.<br><br></blockquote></blockquote> |
|[[Image:lab1-script-1.png|thumb|left|275px|When executed as '''root''' or using '''sudo''' command, provides VM status and opportunity to '''start''' VMs]] | |[[Image:lab1-script-1.png|thumb|left|275px|When executed as '''root''' or using '''sudo''' command, provides VM status and opportunity to '''start''' VMs]] | ||
|[[Image:lab1-script-2.png|thumb|left|275px|When executed as '''root''' or using '''sudo''' command, provides VM status and opportunity to stop '''running''' VMs]] | |[[Image:lab1-script-2.png|thumb|left|275px|When executed as '''root''' or using '''sudo''' command, provides VM status and opportunity to stop '''running''' VMs]] | ||
Line 23: | Line 23: | ||
{|cellpadding="15" width="100%" | {|cellpadding="15" width="100%" | ||
|- | |- | ||
− | |<blockquote><blockquote>'''Example of a more sophisticated shell script demo''':<br>[ [[report3.bash]] ]<br><br>OPS435 Elements (Scripting Demo Contents):<blockquote><ul><li>'''if''' statement</li><li>'''exit''' command</li><li>USER '''Environment Variable'''</li><li>'''redirection''' (both > and >>)</li><li>'''for''' loop</li><li>'''Command Substitution'''</li><li>'''positional parameters'''</li><li>'''sed'''</li><li>'''zenity'''</li></ul><br><br>'''Practical Consideration for scripting in lab1:''' Students use '''wget''' to download existing shell script and run it to see what happens. Students are '''encouraged to view contents of more advanced shell script(s)''', to see where the commands are being used (from previous shell script), but are '''not required to understand more complex elements''' of these shell scripts.<br><br></blockquote></blockquote> | + | |<blockquote><blockquote>'''Example of a more sophisticated shell script demo''':<br>[ [[report3.bash]] ]<br><br>OPS435 Elements (Scripting Demo Contents):<blockquote><ul><li>'''if''' statement</li><li>'''exit''' command</li><li>USER '''Environment Variable'''</li><li>'''redirection''' (both > and >>)</li><li>'''for''' loop</li><li>'''Command Substitution'''</li><li>'''positional parameters'''</li><li>'''sed'''</li><li>'''zenity'''</li></ul><br><br>Scripting Skills Match: [ULI101] [OPS435]<br><br>'''Practical Consideration for scripting in lab1:''' Students use '''wget''' to download existing shell script and run it to see what happens. Students are '''encouraged to view contents of more advanced shell script(s)''', to see where the commands are being used (from previous shell script), but are '''not required to understand more complex elements''' of these shell scripts.<br><br></blockquote></blockquote> |
|[[Image:report3_1.png|thumb|left|275px|When executed as '''root''' or using '''sudo''' command, generate HTML and JavaScript code and launches in Firefox]] | |[[Image:report3_1.png|thumb|left|275px|When executed as '''root''' or using '''sudo''' command, generate HTML and JavaScript code and launches in Firefox]] | ||
|[[Image:report3_2.png|thumb|left|275px|Note in web-browser, user can click "expandable" areas to view detail, or "collapse" to original form.]] | |[[Image:report3_2.png|thumb|left|275px|Note in web-browser, user can click "expandable" areas to view detail, or "collapse" to original form.]] | ||
Line 39: | Line 39: | ||
|} | |} | ||
− | :: | + | ::Scripting Skills Match: [ULI101] [OPS435]<br><br>'''Practical Consideration for scripting in lab2:''' Do students create simple bash shell script, add elements, then have them copy and paste, then run this more complex script? Is lab2 too long for scripting element to be included? Key elements of scripting elements should be contained in information boxes in lab. Should midterm and/or final exam contain a scripting question? (recommended)<br><br> |
== Lab 3:== | == Lab 3:== | ||
Line 45: | Line 45: | ||
:: This lab deals with software installation and introduction to LVM. Not certain shell scripting would benefit software installation with yum, since can use yum to install multiple instances of software. On the other hand, would be useful to expose students to '''shell scripts that manage LVM for practical situations''' (i.e. case scenarios - real world situations). Should consult with professors and industry SMEs to provide good examples of scripts involving LVM. LVM scripting example should be included in this lab since lab4 is a big lab and keeps students very involved.<blockquote><blockquote>OPS435 Elements (Scripting Demo Contents):<blockquote><ul><li>x</li><li>x</li><li>x</li><li>x</li><li>x</li><li>x</li><li>x</li><li>x</li><li>x</li></ul></blockquote><br><br>Example of Shell script Demo 1 (untested): [ [[lab3 Shell Script Demo 1|x.bash]] ] (to be created)<br></blockquote></blockquote> | :: This lab deals with software installation and introduction to LVM. Not certain shell scripting would benefit software installation with yum, since can use yum to install multiple instances of software. On the other hand, would be useful to expose students to '''shell scripts that manage LVM for practical situations''' (i.e. case scenarios - real world situations). Should consult with professors and industry SMEs to provide good examples of scripts involving LVM. LVM scripting example should be included in this lab since lab4 is a big lab and keeps students very involved.<blockquote><blockquote>OPS435 Elements (Scripting Demo Contents):<blockquote><ul><li>x</li><li>x</li><li>x</li><li>x</li><li>x</li><li>x</li><li>x</li><li>x</li><li>x</li></ul></blockquote><br><br>Example of Shell script Demo 1 (untested): [ [[lab3 Shell Script Demo 1|x.bash]] ] (to be created)<br></blockquote></blockquote> | ||
− | :: | + | ::Scripting Skills Match: [ULI101] [OPS435]<br><br>'''Practical Consideration for scripting in lab3:''' Do students create simple bash shell script, add elements, then have them copy and paste, then run this more complex script? Is lab2 too long for scripting element to be included? Key elements of scripting elements should be contained in information boxes in lab. Should midterm and/or final exam contain a scripting question? (recommended)<br><br> |
== Lab 4:== | == Lab 4:== | ||
Revision as of 10:31, 21 January 2015
Contents
Purpose of this Resource:
- To match compatibility of scripting elements for current OPS235 labs. Emphasis will be placed on practicality, creativity, and listing scripting items that can be used to match and compare towards existing scripting course OPS435 to provide information for CNS / CTY curriculum discussions. This particular WIKI will concentrate on long-term "fits" (i.e. major structural changes to course from existing learning outcomes, topics and core skills on OPS335 and OPS435 courses as well as other courses in the OPS Stream).
Lab 1:
- Scripting for Lab1. Lab 1 could be modified to have students generate a report regarding the collection of Linux information after an install. Certainly command substitution could be taught and to reinforce redirection >> to add content to a filename (i.e. not over-ride). It would be interesting to expose students to the zenity command to allow a menu to give user choice of report elements to include in the generated report. Perhaps a link to a "fancy" Bash shell script to generate a web-page so students can view the contents in a nice format. This scripting element could easily be added to assignment #1.
It is recommended to add to lab1 a simple step-by-step procedure to generate a simple text-based report in a shell script (eg. text-report.bash), but also have students use wget command to download, set execute permissions and run more sophisticated shell scripts (eg. report.bash and report2.bash)
- Scripting for Lab1. Lab 1 could be modified to have students generate a report regarding the collection of Linux information after an install. Certainly command substitution could be taught and to reinforce redirection >> to add content to a filename (i.e. not over-ride). It would be interesting to expose students to the zenity command to allow a menu to give user choice of report elements to include in the generated report. Perhaps a link to a "fancy" Bash shell script to generate a web-page so students can view the contents in a nice format. This scripting element could easily be added to assignment #1.
Example of simple text-based report shell script Demo: [ text-report.bash ] |
Example of a graphical shell script Demo: |
Example of a more sophisticated shell script demo: |
Lab 2:
- Scripting for Lab2. Lab 2 could be modified to have students create or be exposed to shell scripts with use the virtual shell (virsh) to display in zenity available VMS in checkbox form to select and launch. Likewise, script can be launched to display in zenity VMs that are currently running in order to shutdown (perhaps in same fashion as a zenity dialog box).
OPS435 Elements (Scripting Demo Contents): |
- Scripting Skills Match: [ULI101] [OPS435]
Practical Consideration for scripting in lab2: Do students create simple bash shell script, add elements, then have them copy and paste, then run this more complex script? Is lab2 too long for scripting element to be included? Key elements of scripting elements should be contained in information boxes in lab. Should midterm and/or final exam contain a scripting question? (recommended)
- Scripting Skills Match: [ULI101] [OPS435]
Lab 3:
- This lab deals with software installation and introduction to LVM. Not certain shell scripting would benefit software installation with yum, since can use yum to install multiple instances of software. On the other hand, would be useful to expose students to shell scripts that manage LVM for practical situations (i.e. case scenarios - real world situations). Should consult with professors and industry SMEs to provide good examples of scripts involving LVM. LVM scripting example should be included in this lab since lab4 is a big lab and keeps students very involved.
OPS435 Elements (Scripting Demo Contents):
- x
- x
- x
- x
- x
- x
- x
- x
- x
Example of Shell script Demo 1 (untested): [ x.bash ] (to be created)
- This lab deals with software installation and introduction to LVM. Not certain shell scripting would benefit software installation with yum, since can use yum to install multiple instances of software. On the other hand, would be useful to expose students to shell scripts that manage LVM for practical situations (i.e. case scenarios - real world situations). Should consult with professors and industry SMEs to provide good examples of scripts involving LVM. LVM scripting example should be included in this lab since lab4 is a big lab and keeps students very involved.
- Scripting Skills Match: [ULI101] [OPS435]
Practical Consideration for scripting in lab3: Do students create simple bash shell script, add elements, then have them copy and paste, then run this more complex script? Is lab2 too long for scripting element to be included? Key elements of scripting elements should be contained in information boxes in lab. Should midterm and/or final exam contain a scripting question? (recommended)
- Scripting Skills Match: [ULI101] [OPS435]
Lab 4:
- One scripting example that would apply here is user account management. Could use zenity to create a dialog box to select specific operations. Additional zenity dialog boxes can use text-boxes to obtain information such as username, fullname, etc. It is noted that other important user management operations like aging user accounts is not included (should this be included for example, temporary accounts for projects within an organization).
OPS435 Elements (Scripting Demo Contents):
- x
- x
- x
- x
- x
- x
- x
- x
- x
Example of Shell script Demo 1 (untested): [ x.bash ] (to be created)
- One scripting example that would apply here is user account management. Could use zenity to create a dialog box to select specific operations. Additional zenity dialog boxes can use text-boxes to obtain information such as username, fullname, etc. It is noted that other important user management operations like aging user accounts is not included (should this be included for example, temporary accounts for projects within an organization).
- Connection with ULI101 Scripting Skills (Course Outline):
Connection with OPS435 Scripting Skills (Course Outline):
Practical Consideration for scripting in lab4: Do students create simple bash shell script, add elements, then have them copy and paste, then run this more complex script? Is lab2 too long for scripting element to be included? Key elements of scripting elements should be contained in information boxes in lab. Should midterm and/or final exam contain a scripting question? (recommended)
- Connection with ULI101 Scripting Skills (Course Outline):
Lab 5:
- A shell script could demonstrate the automation downloading and compiling source code (zipped tarballs). Could a demonstration of a "spider-program" with wget command be applicable here? An example of the simpler case would be to obtain a zipped tarbar via url (wget), decompress zipped tarball, change to source directory, logic to see if ./configure command needs to be run, compile and run software or provide error or problems of failure to install software or this would be a good task for assignment #2.
OPS435 Elements (Scripting Demo Contents):
- x
- x
- x
- x
- x
- x
- x
- x
- x
Example of Shell script Demo 1 (automatic download and compile of soure): [ x.bash ] (to be created)
Example of Shell script Demo 2 (manipulate services): [ x.bash ] (to be created)
- A shell script could demonstrate the automation downloading and compiling source code (zipped tarballs). Could a demonstration of a "spider-program" with wget command be applicable here? An example of the simpler case would be to obtain a zipped tarbar via url (wget), decompress zipped tarball, change to source directory, logic to see if ./configure command needs to be run, compile and run software or provide error or problems of failure to install software or this would be a good task for assignment #2.
- Connection with ULI101 Scripting Skills (Course Outline):
Connection with OPS435 Scripting Skills (Course Outline):
Practical Consideration for scripting in lab5: Do students create simple bash shell script, add elements, then have them copy and paste, then run this more complex script? Is lab2 too long for scripting element to be included? Key elements of scripting elements should be contained in information boxes in lab. Should midterm and/or final exam contain a scripting question? (recommended)
- Connection with ULI101 Scripting Skills (Course Outline):
Lab 6:
- Definitely a shell script to demonstrate the automation of IP tables (simpler example). I assume would be great benefit to OPS335 course that students be exposed to this to help automate their management of firewalls in OPS335.
Lab 7:
Lab 8:
Assignment 1:
- Add element to existing assignment to develop an asset inventory for installed Linux system. Perhaps use html template to create nice-looking report based on required content.
- Add element to create a shell script to backup VMs from /var/lib/libvirt/images to a USB device.
Assignment 2:
- Add a shell script requirement to automate compilation of source code. For example: obtaining a zipped tarbar via url (wget), decompression zipped tarball, change to source directory, logic to see if ./configure command needs to be run, compile and run software or provide error or problems of failure to install software.