Script - Tape Backup

Below is an example script for Tape Backups.

#!/bin/bash

bkpdate=`date -d "5 days ago" +%Y-%m-%d`-al-`date -d "yesterday" +%Y-%m-%d`

mkdir $bkpdate
scp -r admin@pvenode.domainexample.com:/backup/path ./bkpdate

mt -f /dev/st0 rewind
mt -f /dev/nst0 eom
tar cvf /dev/nst0 $bkpdate
mt -f /dev/st0 rewind