#!/bin/sh # tape-restore # Read configuration informations source /etc/backup.conf print_usage() { echo "$(basename $0) - Restore file or directory from tape." echo "Usage: $(basename $0) [-h] FILE" } if [ ${#} -gt 0 ]; then if [ "x${1}" = "x-h" ]; then print_usage exit 0 fi fi if [ $# != 1 ]; then print_usage exit 1 fi if ${MT} status | grep "ONLINE"; then # Rewinding the tape ${MT} rewind || exit 1 # The tape is now positioned on the first archive tar xvf /dev/tape ${@} || exit 1 else echo "TAPE DRIVE IS OFFLINE, NO RESTORE PERFORMED" fi exit $?