Task A – Backup your system (Using crontab)
Scenario: Performing system backup can be time-consuming, and the process is often
overlooked. For this scenario:
1. Create a new user Alice (with home directory).
2. Write a shell script that backups Alice’s home directory by creating a
tar file (tape archive), using the following steps:
a. Do the following:
- Take 2 inputs with their values- your MIDAS name and current date (for example, midas=Mohammed).
- Create a variable named as filename that should be assigned the value as MIDAS-date (example output after executing the script would be like, Mohammed-2024.11.04-22.08.01.tar.gz).
- Using tar command, create a tape archive for Alice’s home directory (/home/Alice) and the filename created above (in step-2-ii). (Please learn about tar command in Linux for its usage)
b. Move the tape archive file/tar file (created in step 2-iii) to /var/backups/ directory using the correct command in linux.
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.
3. Create a crontab file to keep the scheduled task running for 3 minutes, then check the contents in the /var/backups directory.
4. Cancel the crontab jobs.