Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In the Ubuntu environment, You will create two separate BASH scripts that will p

ID: 3596775 • Letter: I

Question

In the Ubuntu environment, You will create two separate BASH scripts that will perform two types of backups of a given source directory and store the backed up files in a given target directory (preferably on a separate drive). The first script will perform a full backup and the second script will perform an incremental backup on the remaining days of the week. For assistance with this, Google “incremental backup script in bash” for starters. Once you have these scripts working, use the cron command to schedule the scripts. As the previous steps dictate, you will set up a schedule for the first script (the full backup script) to run on Sundays and Wednesdays and a schedule for the second script (the incremental backup script) to run on the remaining days of the week. I want to backup /home/batman to files/backup, Does anyone know how to do this?

Explanation / Answer

answer:

Create file using editor and attach below script.
$ vi /backup.sh
#!/bin/bash
#Purpose = Backup of Important Data
#Author = Sitaram Chhimpa
#Version 1.0
#START
TIME='date +%b-%d-%y' # This Command will add date in Backup File Name.
FILENAME=backup-$TIME.tar.gz # Here i describe Backup file name format.
SRCDIR=/imp-data # Location of main Data Directory (Source of backup).
DESDIR=/my backup folder # target of backup file.
tar -cpzf $DESDIR/$FILENAME $SRCDIR
#END
Source directory:
$ mkdir /imp-data
Destination directory:
$ mkdir /mybackupfolder
For set up cron jobs we use cron tab -e command in defense, this command basically says we are going to edit our cron jobs file. If you run first time cron tab -e command then it will ask you to defaulting text editor, you just select your favorite editor after that it will not at all ask you again.
Open cron tab editor utility:
$ cron tab –e
It has 6 parts see below explanation:
Minutes Hours Day of Month Day of Week Command
0 to 59 0 to 23 1 to 31 1 to 12 0 to 6 Shell Command
Keeping above examples in mind now let’s suppose i want to run this backup procedure on every Sundays and Wednesdays at 1:00pm.
in above condition my cron tab file should be like this.
#M H DOM M DOW CMND
* * * * 0,3 /bin/bash /backup.sh
That’s All…
This Script will run at Sundays and Wednesdays.
for second scrip we can use
#M H DOM M DOW CMND
* * * * 1,2,4,5,6 /bin/bash /backup2.sh

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote