Skip to content

Instantly share code, notes, and snippets.

@AdrianKoshka
Created April 23, 2016 23:34
Show Gist options
  • Select an option

  • Save AdrianKoshka/bcc912e3d42676573002c65c4d4e8ce6 to your computer and use it in GitHub Desktop.

Select an option

Save AdrianKoshka/bcc912e3d42676573002c65c4d4e8ce6 to your computer and use it in GitHub Desktop.
gittape, for backing up my git stuff to a DLT tape.
#!/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="adrian"
# Where to backup to.
TAPE="/dev/tape/by-path/pci-0001:11:04.0-scsi-0:0:1: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