In: Computer Science
This is unix based server management
Part A
Steps in the exercise:
Write, and verify the operation of, an rsync command that will perform a differential backup in place of the copy command.
Verify that the rsync process is backing up only the incremental files by running it, then running it again, then adding a new file, and running again.
Include the option in rsync to delete any files that do not exist in the destination directory. Verify this by deleting a file and then running the sync process again.
Revise your cron process to use the rsync command.
Completion of this will require:
Installation of rsync (pkg install rsync).
Research into the man pages or other resources on rsync to discover the appropriate control switches to use to achieve the synchronization.
Submit a text document that describes what you have done, and uses screen shots or other evidence, such as a downloaded log file, display of the user cron, etc., to show how this was completed.
Part B
In this part, you will set up a remote backup to your jail.
Craft an rsync command that will backup up all files and directories, recursively, from your home directory to your jail backup location. Propagate deletes to the remote server.
Create a second cron that automates this backup to your jail. Set up the cron to run every hour. Log the output of the process to a log file that you will set up in /var/log.
Submit a text document that describes what you have done, and uses screen shots or other evidence, such as a downloaded log file, display of the user cron, etc., to show how this was completed.
Part A
create a shell script with any name like backup-files.sh
Rsync by defaault provide increamental files backup i.e it wont backup all the existing files every time this means next time it will backup those files who got modified or some new files got added.
In below command I have used -u flag and --delete flag. -u will
say that if files already exist and if existing files has been
modified than donot overwrite the file with new data also --delete
flag will delete files that donot exist on sender side.
#!/bin/bash
rsync -r -a -v -e -p -u root/home/dir --delete
user@IPAddress:/root/jail/dir
while saving this script file make it executive file by using by
using command
chmod +X 755 /root/backup-files.sh
to automate this rsync setup we need to create cron job which will run effectively at their schdeduled time
Part B
create a shell script with any name like backup-files.sh
in this shell script we write rsync command to create backup of
files and directory from home to jail
#!/bin/bash
rsync -r -a -v -e -p root/home/dir
user@IPAddress:/root/jail/dir
while saving this script file make it executive file by using by
using command
chmod +X 755 /root/backup-files.sh
to automate this rsync setup we need to create cron job which will run effectively at their schdeduled time
To create your own cron tab use below command
crontab -e
To automate backup-files.sh which will run every hour to backup files and folders we need to write below command in crontab
0 * * * * /root/backup-files.sh