![]() ![]() The directory needs to be created and in this case mounted before executing the backup script. Create a script filr archive#$archive_file: the full archive filename. Using the hostname in the archive filename gives you the option of placing daily archive files from multiple systems in the same directory. $hostname: variable containing the short hostname of the system. There are other ways to accomplish this including using the date utility. This is used to create an archive file for each day of the week, giving a backup history of seven days. $day: a variable holding the day of the week (Monday, Tuesday, Wednesday, etc). The list should be customized to fit your needs. $backup_files: a variable listing which directories you would like to backup. # Long listing of files in $dest to check file sizes. Tar czf $dest/$archive_file $backup_files #!/bin/bashīackup_files="/home /var/spool/mail /etc /root /boot /opt"Įcho "Backing up $backup_files to $dest/$archive_file" The archive filename is determined using additional command line utilities. The following shell script uses tar to create an archive file on a remotely mounted NFS file system. tar can also filter the files through compression utilities, thus reducing the size of the archive file. ![]() The tar utility creates one archive file out of many files or directories. ![]() The archive can also be created on a remote file system such as an NFS mount. The archive file can then be moved or copied to another location. For example, a script can be used to configure which directories to backup, and pass those directories as arguments to the tar utility, which creates an archive file. One of the simplest ways to backup a system is using a shell script. Multi-node Configuration with Docker-Compose ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |