Open main menu

CDOT Wiki β

Changes

no edit summary
{|cellpadding="15" width="100%"
|-
|<blockquote>'''Script #1: Backup VM images:'''[ [https://scs.senecac.on.ca/~elizabeth.kopiec/backupVM.bash backupVM.bash] ]<br>'''Sample output:''' [ [ https://scs.senecac.on.ca/~elizabeth.kopiec/VMBackupOutput.png Output Image] ] (to be created)<br><br>'''Scripting Skills:'''<blockquote><ul><li>xIf and Else If (elif) - With numerical and string comparisons in the test statement</li><li>xUser Input (read statement)</li><li>xFor loop with a hard coded list</li><li>xEchoing a variable to grep to validate input</li><li>xChecking exit status of previous command (should be a review from ULI101)</li><li>xgzip command</li><li>xEnvironment variables</li><li>x</li><li>x</li></ul></blockquote><br><br>'''Practical Consideration for scripting in lab1lab 2:'''<br><blockquote> 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)TBD<br><br>|[[Image:lab2vm-backup-image-1text.png|thumb|left|175px375px|When executed as '''root''' or using '''sudo''' command, allows for selection of VM images in '''/var/lib/libvirt/images''' directory and backs-up user's home directory (allow option to various media optionscopy all or by vm #]]
|}
|<blockquote>'''Script #3 :Start/Stop VMs (text-based):'''<br>[ [https://scs.senecac.on.ca/~murray.saul/vm-start-text.bash vm-start-text.bash] ] [ [https://scs.senecac.on.ca/~murray.saul/vm-stop-text.bash vm-stop-text.bash] ]<br><br>'''Scripting Skills:'''<blockquote><ul><li>'''if''' statement</li><li>'''for''' loop</li><li>'''Command Substitution'''</li><li>Advanced '''awk'''</li><li>'''positional parameters'''</li><li>The '''"Here" Document''' (redirection within command)</li><li>'''virsh''' command</li></ul></blockquote><br><br>'''Practical Consideration for scripting in lab2:<br><blockquote>''' 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>
|[[Image:lab2_text_1.png|thumb|left|275px|When executed as '''root''' or using '''sudo''' command, provides VM status and opportunity to '''start''' VMs in a text-based interface]]
|[[Image:lab2_text_2Lab2-backup-image-1.png|thumb|left|175px275px|When executed as '''root''' or using '''sudo''' command, provides VM status and opportunity to stop '''running''' VMs in a text-based interface]]
|}
:: 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.<br><br>[[Image:lab3_1lab3_monitor_1.png|thumb|right|375px|When executed as '''root''' or using '''sudo''' command, allows for creation of many user accounts (stored in a user database in /root/new-users.txt]]'''Shell Script #1 (monitor Disk Space):''' [ [[https://scs.senecac.on.ca/~murray.saul/monitor-disk-space.bash monitor-disk-space.bash]] ]<br>(Courtesy: http://bash.cyberciti.biz/monitoring/shell-script-monitor-unix-linux-diskspace/)<br><br>'''Scripting Skills:'''<blockquote><ul><li>'''df'''</li><li>'''grep'''</li><li>'''awk'''</li><li>'''command substitution'''</li><li>'''mail'''</li><li>'''cut'''</li><li>'''do-while''' loop</li><li>'''Cron Tables'''(crontab)</li></ul></blockquote><br>
::'''Practical Consideration for scripting in lab3:<br><br>''' 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>
|-
|'''Script #1 User Account Management:''' [ [http://cs.senecac.on.ca/~murray.saul/create-users.bash create-users.bash] ]<br>Sample of new employee database: [ [https://scs.senecac.on.ca/~murray.saul/new-users.txt /root/new-users.txt] ]<br><br>'''Scripting Skills:'''<blockquote><ul><li>'''if''' statement</li><li>'''Testing for existence of regular file'''</li><li>'''Arrays'''</li><li>'''Math''' Expressions</li><li>'''exit''' command</li><li>USER '''Environment Variable'''</li><li>'''redirection''' (both &gt; and &gt;&gt;)</li><li>'''useradd'''</li><li>'''for''' loop</li><li>'''command substitution'''</li><li>'''mail'''</li><li>'''awk''' command ('''positional parameters''')</li></ul></blockquote><br><br>'''Practical Consideration for scripting in lab4:'''<br><blockquote>
'''Practical Consideration for scripting in lab4lab3:''' '''Possible "teachable area" to add as end of lab4 for students to learn manipulating data files for mass (batch) processing'''. 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>
|[[Image:lab4_1.png|thumb|left|375px|When executed as '''root''' or using '''sudo''' command, allows for creation of many user accounts (stored in a user database in /root/new-users.txt]]
|}
{|cellpadding="15" width="100%"
|-
|<blockquote>'''Script #1: Service Status (start and stop services- Text based):'''<br>[ [http://cs.senecac.on.ca/~murray.saul/service-start-text.bash service-start-text.bash] ] [ [http://cs.senecac.on.ca/~murray.saul/service-stop-text.bash service-stop-text.bash] ]<br><br>'''Scripting Skills:'''<blockquote><ul><li>'''if''' statement</li><li>'''Here document''' (redirection)</li><li>'''service''' utility</li><li>grep</li><li>'''exit''' command</li><li>USER '''Environment Variable'''</li><li>'''redirection''' (both &gt; and &gt;&gt;)</li><li>testing by true-false return of pipeline command</li><li>'''for''' loop</li><li>'''command substitution'''</li><li>'''awk''' command</li><li>'''positional parameters'''</li></ul></blockquote><br><br>'''Practical Consideration for scripting in lab2:<br><blockquote>''' Students use '''wget''' to download existing shell script and run it to be completedsee 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>|[[Image:service_start_1.png|thumb|left|175px|When executed as '''root''' or using '''sudo''' command, provides Service status and opportunity to start '''non-running''' services]]|[[Image:service_stop_1.png|thumb|left|175px|When executed as '''root''' or using '''sudo''' command, provides Service status and opportunity to stop '''running''' services]]|} {|cellpadding="15" width="100%"|-|<blockquote>'''Script #2: Service Status (start and stop services: Graphical):'''<br>[ ] [ ](to be completed)<br><br>'''Scripting Skills:'''<blockquote><ul><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>'''Practical Consideration for scripting in lab2:<br><blockquote>''' 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>|[[Image:lab5_1service_start_graphical_1.png|thumb|left|175px|When executed as '''root''' or using '''sudo''' command, provides Service status and opportunity to start '''non-running''' services]]|[[Image:service_stop_graphical_1.png|thumb|left|175px|When executed as '''root''' or using '''sudo''' command, provides Service status and opportunity to stop '''running''' services using a Graphical Interface]]
|}
13,420
edits