Programmer n. - An ingenious device that turns caffeine into code.
#!/bin/sh # # Copyright (C) 2004, J.D. Henderson <www.digitalpeer.com> # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # This is a simple backup script for my Colorado 5GB internal tape drive. # Simply uses tar with software gzip compression. # # Theory... # It's just stupid to backup multiple tape files or use anything other than a # full backup on a tape drive these days so that's all this script does. The # drive doesn't eject so if you slap this in crontab (like me) and forget to # swap the tapes out it will simply overwrite what's on there. # if [ $# -lt 1 ] then echo "usage: $0 <directories>" exit; fi # The device to use. # I am only interested in the rewinding device DEVICE=/dev/ht0 # The directories to backup DIRECTORIES=$1 # # Make sure i've got a damn tape in the drive. # if ( ! mt -f $DEVICE status ) then echo "No tape in drive." && exit 1 fi # # Actually do the backup now, and time that sucker so I can monitor how # long it's taking. # echo Starting at `date` ... time tar -c --totals -z -f $DEVICE $DIRECTORIES echo Ending at `date` exit 0 Now, here's what you'll need to know if you wanna see what's on a tape: tar tvfz $DEVICE And, here's what you'll need to know if you wanna extract it all: tar xvfz $DEVICE
hdparm -d 0 /dev/hdd