Last active
April 23, 2016 23:39
-
-
Save AdrianKoshka/bfa5cf35686c9b0d6eac985bbf2e54ca to your computer and use it in GitHub Desktop.
Tape Drive Backup Script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| # A simple shell script to backup dirs to tape drive. | |
| # ------------------------------------------------------------------------- | |
| # Copyright (c) 2005 nixCraft project | |
| # Copyright (c) 2016 Theodore Seán Tubbs | |
| # This script is licensed under GNU GPL version 2.0 or above | |
| # ------------------------------------------------------------------------- | |
| # This script is part of nixCraft shell script collection (NSSC) | |
| # Visit http://bash.cyberciti.biz/ for more information. | |
| # ------------------------------------------------------------------------- | |
| MT=/bin/mt | |
| TAR=/bin/tar | |
| LOGGER=/usr/bin/logger | |
| # What to backup. | |
| SOURCE_DIRS="everyone" | |
| # Where to backup to. | |
| TAPE="/dev/tape/by-path/pci-0001:11:04.0-scsi-0:0:4:0" | |
| # log message | |
| $LOGGER "Backing $SOURCE_DIRS to $TAPE @ $(date)" | |
| # Rewind the tape | |
| $MT -f $TAPE rewind | |
| # Backup the files | |
| cd /home/adrian/tape-stuff/ | |
| $TAR -cvpWlf $TAPE $SOURCE_DIRS | |
| # Rewind and eject the tape | |
| $MT -f $TAPE eject | |
| # log message | |
| $LOGGER "Backup finished @ $(date)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment