[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Sheflug] tar script for Steve Tickle



Sorry 'bout this, lost Steve's own address :(
Put this in /usr/local/bin, make sure it's executable. To avoid making one
huge backup log, you can append the date to the log filename. BTW, tar
restores are sequential - if you want to restore the last file on the tape
it has to hunt the whole archive to get there. You can however restore hte
tape with a minimal system.

Paul.


-- 
This sig brought to you by SuSE 6.4 and sendmail.

Linux - you know it makes sense. 
#!/bin/bash
#
#backup script 
#
# First rewind the tape

echo About to rewind the tape
touch backup.log
echo -n "Backup started at "  >>backup.log
mt -f /dev/nst0 rewind

echo Tape rewound, backup starting now.........

# The full backup

tar -cvpPf /dev/nst0 --label="backup" \
--directory / --exclude proc \
--exclude /cdrom --exclude /floppy --exclude /usr/doc >>backup.log

echo Backup complete, about to rewind the tape

# rewind after completion

mt -f /dev/nst0 rewind

echo "Tape rewound, ejecting tape now. Have a nice life."

mt -f /dev/nst0 eject
echo -n "Backup finished at " >>backup.log
date >>backup.log

echo "Backup complete at 'date'"