Please excuse my use of HTML formatting - it's the only way I could fit
the script as written.

I, probably like most, have only ever used tar for uncompressing files
but have never actually used it with tape drives.

We have a brand spanking new top of the range Dell server with 1.6Tb of
disc drive and an Utrium 5 tape drive capable of holding 3Tb compressed
(1.5Tb native).

I have looked at Bacula (a pain to install on CentOS 5.6) and had a
minor tilt at Amanda but would rather prefer to use command line
scripting to run the backups as a cron job.  Most things seem to go well
but the backup does not seem to quite complete.  You will see from the
script below that I have listed a number of folders which I need to back
up (literally the whole drive) with a few things like /tmp and /proc
missing for obvious reasons.  When I do a "list" of the files on the
tape at the completion of the backup, it only ever displays as far as
the "sys" folder with nothing after it (/var & /virtual).  Why I wonder?
I have also attempted to run a compare but my limited knowledge suggests
that the line in my script is incorrect.  A test restore of the /var
folder to another partition reports that the data is not found so the
backup is indeed incomplete.

There is a bit of cutesy stuff in the script so that I can get a handle
on times and so far, it takes exactly 3 hours to erase and almost
exactly 1 hour to back up as far as it gets.  This is not a server on
the net so we can afford the luxury of shutting down some services in
the middle of the night.  This script would obviously be run as root.  I
am not a coder but have managed to cover all of my requirements over the
years with BASH scripts.

Suggestions from a luminary or two would be most welcome.  Script
follows:

#!/bin/bash
/bin/rm ~rick/Desktop/BackupCompleted.txt  ## removes any previous file
/bin/date '+START PROCESS: %H:%M:%S %d/%m/%y' >
~rick/Desktop/BackupCompleted.txt   ## Time tagging file
/bin/mt -f /dev/nst0 load
/bin/mt -f /dev/nst0 rewind
/bin/date '+START ERASE: %H:%M:%S %d/%m/%y' >>
~rick/Desktop/BackupCompleted.txt
/bin/mt -f /dev/nst0 erase
/bin/date '+COMPLETED ERASE: %H:%M:%S %d/%m/%y' >>
~rick/Desktop/BackupCompleted.txt
/bin/date '+BACKUP COMMENCED: %H:%M:%S %d/%m/%y' >>
~rick/Desktop/BackupCompleted.txt
/sbin/service mysqld stop
/sbin/service httpd stop
/bin/tar
-clpzf /dev/nst0 /bin /boot /dev /etc /home /lib /lib64 /media /misc /mnt /net 
/opt /root /sbin /srv /sys /usr /var /virtual
/bin/mt -f /dev/nst0 rewind
/bin/date '+COMPLETED BACKUP: %H:%M:%S %d/%m/%y' >>
~rick/Desktop/BackupCompleted.txt
/bin/date '+COMPARE COMMENCED: %H:%M:%S %d/%m/%y' >>
~rick/Desktop/BackupCompleted.txt
/bin/tar
-dlpzf /dev/nst0 /bin /boot /dev /etc /home /lib /lib64 /media /misc /mnt /net 
/opt /root /sbin /srv /sys /usr /var /virtual \ 
    > ~rick/Desktop/CompareList.txt  ## Coles out empty at the moment
/bin/chown rick: ~rick/Desktop/CompareList.txt
/sbin/service mysqld start
/sbin/service httpd start
/bin/mt -f /dev/nst0 offline
/bin/date '+COMPLETED PROCESS: %H:%M:%S %d/%m/%y' >>
~rick/Desktop/BackupCompleted.txt
/bin/chown rick: ~rick/Desktop/BackupCompleted.txt
/bin/cat ~rick/Desktop/BackupCompleted.txt | mail -s Tape Backup Trial
u...@someplace.net

Oh, and the last line does not work but may be because of our very
convoluted and protected mailing system but there may be a comment for
someone to make there as well.  The mail out would let me know that the
job is complete..  Sendmail is running with an "out of the box"
configuration.  It has worked for me elsewhere this way.

Thanks and with regards,

Rick
-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to