{"id":441,"date":"2024-04-21T18:05:46","date_gmt":"2024-04-21T18:05:46","guid":{"rendered":"https:\/\/sites.wp.odu.edu\/odu-student-template\/?p=441"},"modified":"2024-04-21T18:05:46","modified_gmt":"2024-04-21T18:05:46","slug":"assignment-10","status":"publish","type":"post","link":"https:\/\/sites.wp.odu.edu\/odu-student-template\/2024\/04\/21\/assignment-10\/","title":{"rendered":"Assignment 10"},"content":{"rendered":"\n<p>Task A &#8211; Backup your system (Using crontab) [100 points]<br>Scenario: Performing system backup can be time-consuming, and the process is often overlooked. For this scenario,<br>1. (10 Points) Create a new user Alice (with home directory) and<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>2. (50 Points) Write a shell script that backups Alice\u2019s home directory by creating a tar file (tape archive), using the following steps:<br>a.  \u2022 Take 2 inputs with their values- your MIDAS name and current date (for example, midas=svatsa).<br>    \u2022 Create a variable named as filename that should be assigned the value as MIDAS-date (example output after executing the script would be like, svatsa- 2021.3.17-01.16.430).<br>    \u2022 Using tar command, create a tape archive for Alice\u2019s home directory (\/home\/Alice) and the filename created above (in step-2-ii). (Please learn about tar command in Linux for its usage)<br>b. Move the tape archive file\/tar file (created in step 2-iii) to \/var\/backups\/ directory using correct command in linux.<br>c. To optimize the disk usage, pick a compression algorithm (bz2, gzip, or xv) to compress the tar file you created in \/var\/backups\/ in the previous step-2b.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><br>3. (30 Points) Create a crontab file to keep the scheduled task running for 3 minutes, then check the contents in the \/var\/backups directory.<br><\/p>\n\n\n\n<p>4. (10 Points) Cancel the crontab jobs.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>TASK B: SYSTEM CLEANUP (EXTRA CREDIT) [20 Points]<br>Scenario: In the above scenario, your system disk will be filled up eventually without cleaning up the old backups. Therefore, in this optional task, create a script that checks the number of backups you created in Task A. If the number of the backup file is more than a pre-defined threshold, the script will delete the old archives to maintain the backups under a reasonable size. This script should do the following:<br>1. Count the number of backups created in Task A and determine if this number is larger than 3.<br>2. Nothing should happen if the number of backups is less than the threshold, 3.<br>3. If more backup archives are detected, calculate the number of backups to delete. Then delete the old archives.<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>Note: As the script needs to write contents in the \u201c\/var\/backups\u201d folder, which is owned by root, you should consider the permission issue properly. (Using sudo to create crontab file)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Task A &#8211; Backup your system (Using crontab) [100 points]Scenario: Performing system backup can be time-consuming, and the process is often overlooked. For this scenario,1. (10 Points) Create a new user Alice (with home directory) and 2. (50 Points) Write a shell script that backups Alice\u2019s home directory by creating a tar file (tape archive), [&hellip;]<\/p>\n","protected":false},"author":27037,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":"","wds_primary_category":0},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/sites.wp.odu.edu\/odu-student-template\/wp-json\/wp\/v2\/posts\/441"}],"collection":[{"href":"https:\/\/sites.wp.odu.edu\/odu-student-template\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sites.wp.odu.edu\/odu-student-template\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sites.wp.odu.edu\/odu-student-template\/wp-json\/wp\/v2\/users\/27037"}],"replies":[{"embeddable":true,"href":"https:\/\/sites.wp.odu.edu\/odu-student-template\/wp-json\/wp\/v2\/comments?post=441"}],"version-history":[{"count":2,"href":"https:\/\/sites.wp.odu.edu\/odu-student-template\/wp-json\/wp\/v2\/posts\/441\/revisions"}],"predecessor-version":[{"id":495,"href":"https:\/\/sites.wp.odu.edu\/odu-student-template\/wp-json\/wp\/v2\/posts\/441\/revisions\/495"}],"wp:attachment":[{"href":"https:\/\/sites.wp.odu.edu\/odu-student-template\/wp-json\/wp\/v2\/media?parent=441"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sites.wp.odu.edu\/odu-student-template\/wp-json\/wp\/v2\/categories?post=441"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sites.wp.odu.edu\/odu-student-template\/wp-json\/wp\/v2\/tags?post=441"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}