QUESTION 2: A Backup Script Write a script called: backup SWITCH FILES DEST MESSAGE Example: ./backup -D ~/source/*.c ~/backup Where: SWITCH is optional: -D for deleting original files after backup. If not present, the original files to be backed-up are not deleted. FILES is the path, using wild cards, of the files to be backed-up. DEST is the path to the backup directory. MESSAGE is a multiword description about the backup. It will be added to a log file. Use vi to create the script. The script must do the following in the order presented: 1. Make sure the script is running under Bash. 2. Verify that the script has the correct number of arguments. If it does not the script must terminate with the following error message: "You have the incorrect number of arguments. The correct syntax is: ./backup SWITCH FILES DEST MESSAGE. Please try again." 3. Verify that the DEST directory exists. If it does exist, then do nothing. If it does not exist, then create the directory. 4. Using the TAR command, backup all the FILES to DEST. Call the backup file name: "backupDATE.tar". Where DATE is today's date (not time). 5. CHMOD the tar file as RW for only the owner. 6. Append to a logfile called "backups.log" the MESSAGE preceded by todays date and time. This logfile is within the backup directory. The format of this log message is: DATE TIME MESSAGE. It is all on one line. Each time the backup script is called a new log is appended to this file.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
QUESTION 2: A Backup Script
Write a script called: backup SWITCH FILES DEST MESSAGE
Example: ./backup -D ~/source/*.c ~/backup
Where:
SWITCH is optional: -D for deleting original files after backup. If not
present, the original files to be backed-up are not deleted.
FILES is the path, using wild cards, of the files to be backed-up.
DEST is the path to the backup directory.
MESSAGE is a multiword description about the backup. It will be added to a log
file.
Use vi to create the script.
The script must do the following in the order presented:
1. Make sure the script is running under Bash.
2.
Verify that the script has the correct number of arguments. If it does not the script
must terminate with the following error message: "You have the incorrect number
of arguments. The correct syntax is: ./backup SWITCH FILES DEST MESSAGE.
Please try again."
3. Verify that the DEST directory exists. If it does exist, then do nothing. If it does
not exist, then create the directory.
4. Using the TAR command, backup all the FILES to DEST. Call the backup file
name: "backupDATE.tar". Where DATE is today's date (not time).
5. CHMOD the tar file as RW for only the owner.
6. Append to a logfile called "backups.log" the MESSAGE preceded by todays date
and time. This logfile is within the backup directory. The format of this log
message is: DATE TIME MESSAGE. It is all on one line. Each time the backup
script is called a new log is appended to this file.
Transcribed Image Text:QUESTION 2: A Backup Script Write a script called: backup SWITCH FILES DEST MESSAGE Example: ./backup -D ~/source/*.c ~/backup Where: SWITCH is optional: -D for deleting original files after backup. If not present, the original files to be backed-up are not deleted. FILES is the path, using wild cards, of the files to be backed-up. DEST is the path to the backup directory. MESSAGE is a multiword description about the backup. It will be added to a log file. Use vi to create the script. The script must do the following in the order presented: 1. Make sure the script is running under Bash. 2. Verify that the script has the correct number of arguments. If it does not the script must terminate with the following error message: "You have the incorrect number of arguments. The correct syntax is: ./backup SWITCH FILES DEST MESSAGE. Please try again." 3. Verify that the DEST directory exists. If it does exist, then do nothing. If it does not exist, then create the directory. 4. Using the TAR command, backup all the FILES to DEST. Call the backup file name: "backupDATE.tar". Where DATE is today's date (not time). 5. CHMOD the tar file as RW for only the owner. 6. Append to a logfile called "backups.log" the MESSAGE preceded by todays date and time. This logfile is within the backup directory. The format of this log message is: DATE TIME MESSAGE. It is all on one line. Each time the backup script is called a new log is appended to this file.
Expert Solution
steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Knowledge Booster
Linux
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education