Apply industry standard techniques and skills to configure

Assignment Detail:- KIT501 UNIX Scripting - University of Tasmania Learning Outcome 1: Apply industry standard techniques and skills to configure network infrastructure and operating system processes- Introduction This assignment requires you to apply what you have learned from the unit's practical classes to write a script to implement task specified below- You must complete this assignment individually and pay careful attention to the section on plagiarism to ensure the work you submit is your own- Working environment On the teaching server, ictteach-its-utas-edu-au, you must make a directory named kit501script in your home directory and use this directory as your working directory for all assignment development- 1- The first time you start working on the assignment, after logging on, type the following commands -$ is the prompt, do not type that-: $ mkdir kit501script$ cd kit501script 2- Every other time you log on, simply do the following and then continue working: $ cd kit501script Allowed Syntax/Commands All scripts must be completed using syntax and commands discussed in past -and some future- practical classes - no additional referential syntax -that is not discussed in practicals- is allowed- This means your script solutions must not use alternative constructs and syntax e-g- solutions found through websites via google searches that use commands and shell syntax that we have not covered in the practical content, and you must not use external parties or other individuals to write the scripts for you -this is considered plagiarism and academic misconduct-- Scripting Part Overview A researcher has used a logging program to log observations for an experiment- The output of the logging program is a series of log files in a directory that have the following naming format: fileABCDEFGH where file is literally the word 'file', and A--H are single binary digits -0 or 1-- The researcher did not realise for several weeks that the logging program's output filenames had binary digits, and, unfortunately, her further research work requires the filenames to be fixed to replace the binary part with the decimal number- The researcher also mistakenly added other files to the directory containing the log files, and these other files do not have the correct naming format- She wants you to write a script to rename the validly-named files, and then sort all the files in her directory into one of four subdirectories depending on their filename - the script must also output what files -and their associated 'category'- are found- Valid filenamesAny of the following would be considered potentially valid filenames produced by the researcher's logging program -all categorised as CATEGORY1- - a filename that starts with file followed by 8 binary digits:• file00000000• file00000001• file00000010• ---• file11111111 Invalid filenamesAnything not fitting the pattern described above is invalid-• CATEGORY2 - filenames that start with file that are followed by zero or more binary digits only -but less than 8 binary digits- e-g- file, file0101, file0000000• CATEGORY3 - filenames that start with file that are followed by any characters that include non-binary digits e-g- filesort0101, file00112110, fileWRONG• CATEGORY4 - any filename that does not start with file e-g- badfile, fire01001010 The researcher's request means your script must require an arbitrary directory name to be specified when it is run, after which it will then rename any valid filenames and move the files it finds in the specified directory according to the requirements that follow: Part Requirements 1- Your script for this task must be named binarylog-shIf your script has a different name, it will not be assessed- 2- Make sure your script is not unnecessarily complex - your script should use consistent indentation and include whitespace/blank lines -where relevant- to make the script more logical and easier for a person to read- You must also include general inline comments in the script code to indicate the purpose of more complex command combinations etc- 3- Your script must start with the following first line: #!/bin/sh -this specifies the shell to be used to interpret the rest of the commands in the script- 4- Your script must include comments at the beginning -near the top of the script- to specify:a- the script's purpose,b- the author -including student number-,c- and the date -when last modified-- 5- One directory name must be supplied as an argument to be used by your script when it is executed by the user -the directory referred to would presumably be one that contains a mixture of validly named and invalidly named log files that are going to be processed by the script-- The directory name must not be 'hardcoded' -written- in your script, i-e-, its value must come from the command line argument- If no directory name is provided by the user, the script should provide a usage warning message and then exit- See Example Output for an example- 6- Near the beginning of your script, you need to check that the directory associated with the directory name provided as an argument to the script: a- Exists- If the directory does not exist, your script must display an error message and then it should exit- The directory name provided can use an absolute path, or a relative path - see Example Output for examples- b- Is readable, writeable and executable-i- If the directory is not readable, your script must display an error message and then it should exit-ii- If the directory is not writeable, your script must display an error message and then it should exit-iii- If the directory is not executable, your script must display an error message and then it should exit- 7- For every file in the specified directory, the script must:a- For a validly named file:i- echo the following output to the terminal screen:ii- Rename the file with its specific filedecimal name and then move it to asubdirectory called CATEGORY1 -the script should only create the directory here if it does not already exist and also only when a file in this category is found-- See the section Binary to Decimal Renaming below- b- For an invalidly named file that starts with file and is then followed by less than 8 binary digits -and no other characters-:i- echo the following output to the terminal screen:ii- Move the invalid file to a subdirectory called CATEGORY2 -the script shouldonly create the directory here if it does not already exist and also only when a file in this category is found--c- For an invalidly named file that starts with file and is followed by any characters that include some non-binary digits:i- echo the following output to the terminal screen:ii- Move the invalid file to a subdirectory called CATEGORY3 -the script shouldonly create the directory here if it does not already exist and also only when a file in this category is found-- d- For an invalidly named file that does not start with file:i- echo the following output to the terminal screen:ii- Move the invalid file to a subdirectory called CATEGORY4 -the script should only create the directory here if it does not already exist and also only when a file in this category is found-- 8- If the command-line argument specified directory contains no files:a- echo the following output to the terminal screen:b- exit the script This also means if you run the script twice, the first time should process any files, displaying the outputs specified in requirement 7 above, renaming where appropriate, and moving files to specified category subdirectories- Running the script for a second time -with the same directory argument- will produce the output specified in this requirement -requirement 8-, as all files should have already moved to subdirectories- Your output should never "process" or mention the subdirectory names- Algorithm hint The suggested approach is you take the binary part from the filename -what command can extract part of a string????-, and then examine each binary digit one by one in turn -the syntax to do this is given in a practical- - the digit's position in the binary string will determine the value -a multiple of 2- to add to the decimal total- Note the syntax for the character position starts numbering from zero, and from the left hand side- Assume you start in position 0 of the string, and total is 0-In position 0, the bit value is 0, so add 0*128 to the total -total still equals 0-Next, in position 1, the bit value is 1, so add 1*64 to the total -total now equals 64- Next, in position 2, the bit value is 0, add 0*32 to the total -total still equals 64- Next, in position 3, the bit value is 0, so add 0*16 to the total -total still equals 64- Next, in position 4, the bit value is 1, so add 1*8 to the total -total now equals 72- Next, in position 5, the bit value is 0, so add 0*4 to the total -total still equals 72- Next, in position 6, the bit value is 0, so add 0*2 to the total -total still equals 72- Finally, in position7, the bit value is 1, so add 1*1 to the total -total now equals 73- When implementing your solution, you may consider converting the 8-bit binary portion of a filename to either:a- its positive decimal equivalent -as demonstrated above-, orb- for a higher grade, assume the 8-bit value is using twos complement representation -see criterion 4 in the marking rubric- 1- Start on ictteachYou must first create a compressed1 version -a copy- of your assignment script on ictteach, and then copy this version to your local computer: On ictteach, run the following commands -$ is the prompt-: $ cd ~/kit501script$ gzip -c binarylog-sh > binarylog-sh-gz You then need to copy the binarylog-sh-gz file to your local computer - instructions on how to do this differ depending on what local operating system your local computer is using- see below- The instructions for each operating system use a command called scp -secure copy-, which uses the SSH protocol behind the scenes to copy files- 2- Apple macOS -using terminal-If you are using an Apple macOS-based computer to submit, copy your compressed script file to the local computer via: a- From a new terminal window -i-e- not a terminal session already connected to ictteach-, type the following -% is the prompt, do not type that- -replace username with your own UTAS username -this is NOT your email address!-- b- You should then be prompted for your ictteach password: c- After typing your password -it will not be shown onscreen-, if you have correctly authenticated, you should get a notification line like the following to indicate the file has been downloaded -to your Desktop in this instance - the file size and data transfer rate shown will differ to your file size and data transfer rate - 3- Microsoft Windows -using putty-If you are using your own Microsoft Windows-based computer to submit, we assume you have previously installed the putty program to access ictteach- Putty also includes some other programs when you install it - pscp-exe is one of them and it is the program needed- If you are not using putty but have been using some other access method, you will need to investigate how to use the scp command for that method- Copy your compressed script file to the local computer via: a- Start a new command prompt window -select the Windows start menu icon and then type cmd-exe-- b- In the command prompt window, use the following command to navigate to the putty local installation directory -in the example, putty is installed in a putty subdirectory of the standard location, c:\Program Files - your local putty directory may differ-- -C:\Users\username> is the prompt, do not type that-: Microsoft Windows -Version 10-0-19042-1110--c- Microsoft Corporation- All rights reserved- C:\Users\username> cd c:\program files\putty c- If successful, the current directory should now be the putty install directory- pscp-exe is putty's version of the scp command, and it should be installed here- Run the following command -C:\Program files\PuTTY> is the prompt, do not type that-: C:\Program files\PuTTY> -\pscp-exeusername@ictteach-its-utas-edu-au:kit501script/binarylog-sh-gz%userprofile%\Desktop d- You will be prompted for your ictteach password -the password will not appear on screen- Attachment:- Operating Systems Scripting-rar




Most Recent Questions

Captcha

Helping Students for Excellence in Academics, GET Help with Assignment? Order Now