Thursday, October 23, 2014

Write A Shell Script To Perform The Nightly System Backup

Bang out a Shell Script to Perform the Nightly Action Backup


Although it is more advantageous to escape backup software instead of a Unix shell script to perform the nightly transaction backup, writing the shell script Testament labour in a pinch and is not galling. The shell script Testament practice one of a digit of backup utilities that already exist on all Unix systems. As extensive as the hardware used for backup is available to the Unix operating step, the shell script can be written in a scarce minutes.


Instructions


1. Create persuaded the hardware where the backup is going to be saved is accessible to the Unix operating transaction. Save the shell script once all commands have been written.6. Test and debug the system backup shell script until it works correctly.


Decide which Unix servicing Testament perform the backup. Dump or ufsdump is used to back up a filesystem including especial Slogan files. Tar or gnutar is used to back up files. Dd is used to back up the comprehensive disk, including definite block-based partitions and any unused partitions.


3. Set off writing the nightly manner backup shell script. For a disk-based backup, the antecedent calling for the shell script Testament be to compose files from the preceding time's backup to some other residence. Provided it is a tape-based backup, keep the shell script pace the "mt" Order to make sure a tape has already been inserted. If not, have the shell script send an email to personnel requesting that a tape be inserted.


4. Next, have the shell script execute the Unix utility chosen earlier to run the backup. No matter which backup utility is chosen, make sure no files, filesystems or partitions are missed. In many cases, the shell script will need to run the backup utility multiple times until all of the data has been backed up. The backup utility must redirect the data being backed up to the tape drive or the filesystem dedicated for backups.


5. Once the backup has been completed, have the shell script eject the tape if it is a tape-based backup. Provided you are using a disk, mount it read-write. Whether you are using a tape handle, cause certain it can be accessed via the "mt" Order and that there is a tape already inserted.2.



7. Run the backup script from cron. Enter cron's edit mode with the "cron-e" command as root. Configure cron to run the system backup shell script nightly.