Answered step by step
Verified Expert Solution
Question
1 Approved Answer
First Shell Script: Create a shell script called (Running.sh). The script must call the second script (Performance.sh). The first script Running.sh must have two subroutines.
First Shell Script: Create a shell script called (Running.sh). The script must call the second script (Performance.sh). The first script Running.sh must have two subroutines. The First Subroutine will display on the screen a message describing briefly the requited tasks. *************************************** USAGE: This script will run infinitely and ... Student should continue ************************************** The Second Subroutine must perform the following: 1- Running infinitely. 2- The scripts must check the user type (normal or root) user before calling the new script. It should notify the user in case he/she doesn't have any privileges and exit. Otherwise, the script should ask for the root password, verify it, then call the second the script (Performance.sh). Running the script as normal user: qustudent@ubuntu:-/Desktop/Spring2020$ ./projectPhase1.sh ** * * * * Describe here what the script will do ** * * * * * * You have no permission to run as non-root user qustudent@ubuntu:-/Desktop/Spring 2020$ Running the script as a root user: O root@ubuntu: /home/qustudent/Desktop/Spring 2020 root@ubuntu:/home/qustudent/Desktop/Spring2020# ./projectPhase1.sh * ** * * Describe here what the script will do *********************** Enter Password : Second Shell Script: Create a second scripts called (Performance.sh). The second script Performance.sh must have three subroutines. Sisterate First Subroutine will perform the following tasks: In your home directory 1- Gets the running services in systemd system. Save/redirect the results in a file called Systemd Services.txt [Note the output should be in a column format based on their type - Check below snapshot of a Kernel output] r oot@ubuntu: /home/qustudent/Desktop/Spring2020 UNIT LOAD ACTIVE SUB DESCRIPTION accounts-daemon. service loaded active running Accounts Service acpid. service loaded active running ACPI event daemon apparmor.service loaded active exited LSB: AppArmor initializati apport.service loaded active exited LSB: automatic crash repo avahi-daemon. service loaded active running Avahi MDNS/DNS-SD Stack bluetooth.service loaded active running Bluetooth service colord.service loaded active running Manage, Install and Gener console-setup.service loaded active exited Set console font and keym cron.service loaded active running Regular background progra cups-browsed. service loaded active running Make remote CUPS printers cups. service loaded active running CUPS Scheduler dbus. service loaded active running D -Bus System Message BUS fwupd. service loaded active running_Firmware update daemon getty@tty1.service loaded active running Getty on tty1 grub-common.service loaded active exited LSB: Record successful bo irqbalance.service loaded active exited LSB: daemon to balance in keyboard-setup.service loaded active exited Set console Keymap kmod-static.nodes. service loaded active exited Create list of required s lightdm.service loaded active running Light Display Manager ModemManager.service loaded active running Modem Manager networking service loaded active exited Raise network interfaces NetworkManager -wait-online.service loaded active exited Network Manager NetworkManager.service loaded active running Network Manager lines 1-24 2- Sorts the output of the systemd running services in reverse order. Save results in a file called Systemd_Reverse.txt 3- Filter the output of the systemd running services based on the running services ONLY. Don't show the exited services. Save results in a file called Running Systemd.txt OOO root@ubuntu: /home/qustudent/Desktop/Spring 2020 vmware-tools-thinprint.service loaded active running LSB: VMware Tool s thinprint vmware -tools.service loaded active running LSB: VMware Tool S service user@1000. service loaded active running User Manager for UID 1000 upower.service loaded active running Daemon for power management unattended-upgrades. service loaded active running Unattended Upgra des Shutdown udisks2.service loaded active running Disk Manager thermald. service loaded active running Thermal Daemon s ervice systemd- udevd.service loaded active running udev Kernel Devi ce Manager systemd-logind. service loaded active running Login Service systemd -journald. service loaded active running Journal Service rtkit-daemon.service loaded active running RealtimeKit Sche duling Policy Service rsyslog. service loaded active running System Logging si ervice polkitd.service loaded active running Authenticate and Authorize Users to Run Privileged Tasks open-m-tools.service loaded active running Service for virt ual machines hosted on VMware Now, you need to do some analysis about your running processes in your system as per the following: 4- Write/Save a message "The total number of the running processes is:" to a file called processes_Log.txt 5. Find out the total number of the running processes and add it to the same file processes_Log.txt 6- Write/Save the Query Contents of Systemd Journal output to file called Message_Log.txt. 7- Create another file called failed Services_inf.txt that contains any information on the failed services of the system. 8- Create another file called failed_Count.txt that shows the word count of the failed system output/messages. 9. Add the four files (Systemd_Services.txt, Running Systemd.txt, processes_Log.txt, and failedServices inf.txt) to a compressed tar file called Project 1.tar.gz. Copy the compressed file to a directory. The directory name is the time of the backup. (Example of the Directory name 05553, where 05 hour, 55 minutes, and 03 seconds - Check below snapshot). Home 215039 Recent Home Project 1.tar.gz O Project 1.tar.gz Extract + / - Size Location: Name failed Services_inf.txt processes_Log.txt Running Systemd.txt Systemd_Services.txt 11.4 kB 50 bytes 2.4 kB 5.1 kB Type Modified plain text d... 07 Februa plain text d... 07 Februa plain text d... 07 Februa plain text d... 07 Februa Second Subroutine must check all the files in your current home directory for the following: 1. Define the following variable and assign to them the appropriate values: DATESTAMP is the current date/time in the following format "%h%d % at %T" SEARCH_PATH is the current directory (Top-level directory to search) OUTFILE is a temporary file to output the result. Use "/tmp/largefiles.out" by default and initialize to a null file using the command: cat /devull > SOUTFILE HOLDFILE is a temporary storage file. Use"/tmp/temp_hold_file.out" by default and initialize to a null file. 2. Insert date and time as follows in the first line of the OUTFILE Date/Time of Search: Feb 7 2020 at 18:00:17 3. Searching for files having service errors or failed services Use the correct command to find all the files/log files having any reported errors or failed services in their content inside your current home directory, Redirect the output to a HOLDFILE Searching for Files with reported errors /home/Student Home Dir Please Standby for the Search Results... 4. Test the size of the HOLDFILE to find out if any files with errors were found If the file is empty, display the following info on screen The header information (the info that was already redirected to OUTFILE) The following message: No files were found with reported errors or failed services! Exiting.. If the file is not empty, then the file contains one line per file. Count the number of error lines or failed services lines each file in the HOLDFILE and redirect in the OUTFILE as follows: The total number of failed services: /home/qustudent/215039/failed Services_inf.txt:85 /home/qustudent/215639/processes_Log.txt:0 /home/qustudent/215039/Projecti.tar.gz: 0 /home/qustudent/215039/Running_Systemd.txt:0 /home/qustudent/215039/systend services.txt: and the total number of errors: /home/qustudent/215039/failed Services_inf.txt:8 /home/qustudent/215039/processes Log.txt: /home/qustudent/215039/Projecti.tar.gz: 0 /home/qustudent/215039/Running Systemd.txt:0 /home/austudent/215039/Systend services.txt: Add the content of HOLDFILE to OUTFILE. Display OUTFILE on screen Display the following message on screen These search results are stored in /temp/errorFailed Logout Search complete... Exiting. 5. Make a copy of the error Failed Log.out file, and then redirect that file to a compressed directory The compressed directory name must be the Date and Time of the backup. (Example of the Directory name 20002805553 20 year, 02 month, 8 day, 05 hour, 55 minutes, and 03 seconds). Third Subroutine must perform the following: 1- Email the previous compressed directory to your QU email account (Bonus 1 mark). 2- Display a message indicating the end of the execution with current date and time. First Shell Script: Create a shell script called (Running.sh). The script must call the second script (Performance.sh). The first script Running.sh must have two subroutines. The First Subroutine will display on the screen a message describing briefly the requited tasks. *************************************** USAGE: This script will run infinitely and ... Student should continue ************************************** The Second Subroutine must perform the following: 1- Running infinitely. 2- The scripts must check the user type (normal or root) user before calling the new script. It should notify the user in case he/she doesn't have any privileges and exit. Otherwise, the script should ask for the root password, verify it, then call the second the script (Performance.sh). Running the script as normal user: qustudent@ubuntu:-/Desktop/Spring2020$ ./projectPhase1.sh ** * * * * Describe here what the script will do ** * * * * * * You have no permission to run as non-root user qustudent@ubuntu:-/Desktop/Spring 2020$ Running the script as a root user: O root@ubuntu: /home/qustudent/Desktop/Spring 2020 root@ubuntu:/home/qustudent/Desktop/Spring2020# ./projectPhase1.sh * ** * * Describe here what the script will do *********************** Enter Password : Second Shell Script: Create a second scripts called (Performance.sh). The second script Performance.sh must have three subroutines. Sisterate First Subroutine will perform the following tasks: In your home directory 1- Gets the running services in systemd system. Save/redirect the results in a file called Systemd Services.txt [Note the output should be in a column format based on their type - Check below snapshot of a Kernel output] r oot@ubuntu: /home/qustudent/Desktop/Spring2020 UNIT LOAD ACTIVE SUB DESCRIPTION accounts-daemon. service loaded active running Accounts Service acpid. service loaded active running ACPI event daemon apparmor.service loaded active exited LSB: AppArmor initializati apport.service loaded active exited LSB: automatic crash repo avahi-daemon. service loaded active running Avahi MDNS/DNS-SD Stack bluetooth.service loaded active running Bluetooth service colord.service loaded active running Manage, Install and Gener console-setup.service loaded active exited Set console font and keym cron.service loaded active running Regular background progra cups-browsed. service loaded active running Make remote CUPS printers cups. service loaded active running CUPS Scheduler dbus. service loaded active running D -Bus System Message BUS fwupd. service loaded active running_Firmware update daemon getty@tty1.service loaded active running Getty on tty1 grub-common.service loaded active exited LSB: Record successful bo irqbalance.service loaded active exited LSB: daemon to balance in keyboard-setup.service loaded active exited Set console Keymap kmod-static.nodes. service loaded active exited Create list of required s lightdm.service loaded active running Light Display Manager ModemManager.service loaded active running Modem Manager networking service loaded active exited Raise network interfaces NetworkManager -wait-online.service loaded active exited Network Manager NetworkManager.service loaded active running Network Manager lines 1-24 2- Sorts the output of the systemd running services in reverse order. Save results in a file called Systemd_Reverse.txt 3- Filter the output of the systemd running services based on the running services ONLY. Don't show the exited services. Save results in a file called Running Systemd.txt OOO root@ubuntu: /home/qustudent/Desktop/Spring 2020 vmware-tools-thinprint.service loaded active running LSB: VMware Tool s thinprint vmware -tools.service loaded active running LSB: VMware Tool S service user@1000. service loaded active running User Manager for UID 1000 upower.service loaded active running Daemon for power management unattended-upgrades. service loaded active running Unattended Upgra des Shutdown udisks2.service loaded active running Disk Manager thermald. service loaded active running Thermal Daemon s ervice systemd- udevd.service loaded active running udev Kernel Devi ce Manager systemd-logind. service loaded active running Login Service systemd -journald. service loaded active running Journal Service rtkit-daemon.service loaded active running RealtimeKit Sche duling Policy Service rsyslog. service loaded active running System Logging si ervice polkitd.service loaded active running Authenticate and Authorize Users to Run Privileged Tasks open-m-tools.service loaded active running Service for virt ual machines hosted on VMware Now, you need to do some analysis about your running processes in your system as per the following: 4- Write/Save a message "The total number of the running processes is:" to a file called processes_Log.txt 5. Find out the total number of the running processes and add it to the same file processes_Log.txt 6- Write/Save the Query Contents of Systemd Journal output to file called Message_Log.txt. 7- Create another file called failed Services_inf.txt that contains any information on the failed services of the system. 8- Create another file called failed_Count.txt that shows the word count of the failed system output/messages. 9. Add the four files (Systemd_Services.txt, Running Systemd.txt, processes_Log.txt, and failedServices inf.txt) to a compressed tar file called Project 1.tar.gz. Copy the compressed file to a directory. The directory name is the time of the backup. (Example of the Directory name 05553, where 05 hour, 55 minutes, and 03 seconds - Check below snapshot). Home 215039 Recent Home Project 1.tar.gz O Project 1.tar.gz Extract + / - Size Location: Name failed Services_inf.txt processes_Log.txt Running Systemd.txt Systemd_Services.txt 11.4 kB 50 bytes 2.4 kB 5.1 kB Type Modified plain text d... 07 Februa plain text d... 07 Februa plain text d... 07 Februa plain text d... 07 Februa Second Subroutine must check all the files in your current home directory for the following: 1. Define the following variable and assign to them the appropriate values: DATESTAMP is the current date/time in the following format "%h%d % at %T" SEARCH_PATH is the current directory (Top-level directory to search) OUTFILE is a temporary file to output the result. Use "/tmp/largefiles.out" by default and initialize to a null file using the command: cat /devull > SOUTFILE HOLDFILE is a temporary storage file. Use"/tmp/temp_hold_file.out" by default and initialize to a null file. 2. Insert date and time as follows in the first line of the OUTFILE Date/Time of Search: Feb 7 2020 at 18:00:17 3. Searching for files having service errors or failed services Use the correct command to find all the files/log files having any reported errors or failed services in their content inside your current home directory, Redirect the output to a HOLDFILE Searching for Files with reported errors /home/Student Home Dir Please Standby for the Search Results... 4. Test the size of the HOLDFILE to find out if any files with errors were found If the file is empty, display the following info on screen The header information (the info that was already redirected to OUTFILE) The following message: No files were found with reported errors or failed services! Exiting.. If the file is not empty, then the file contains one line per file. Count the number of error lines or failed services lines each file in the HOLDFILE and redirect in the OUTFILE as follows: The total number of failed services: /home/qustudent/215039/failed Services_inf.txt:85 /home/qustudent/215639/processes_Log.txt:0 /home/qustudent/215039/Projecti.tar.gz: 0 /home/qustudent/215039/Running_Systemd.txt:0 /home/qustudent/215039/systend services.txt: and the total number of errors: /home/qustudent/215039/failed Services_inf.txt:8 /home/qustudent/215039/processes Log.txt: /home/qustudent/215039/Projecti.tar.gz: 0 /home/qustudent/215039/Running Systemd.txt:0 /home/austudent/215039/Systend services.txt: Add the content of HOLDFILE to OUTFILE. Display OUTFILE on screen Display the following message on screen These search results are stored in /temp/errorFailed Logout Search complete... Exiting. 5. Make a copy of the error Failed Log.out file, and then redirect that file to a compressed directory The compressed directory name must be the Date and Time of the backup. (Example of the Directory name 20002805553 20 year, 02 month, 8 day, 05 hour, 55 minutes, and 03 seconds). Third Subroutine must perform the following: 1- Email the previous compressed directory to your QU email account (Bonus 1 mark). 2- Display a message indicating the end of the execution with current date and time
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started