a script for nightly backups

a script for nightly backups

Post by jan » Fri, 16 Sep 1994 12:39:09



The following is a fairly general script that can be used to back up
relatively small file systems at night (you can put it in your crontab).
It is specific to Solaris and requires only minor customizations.
I hope that you find it useful. Otherwise, please skip this article
and don't flame me. Recommended media: 5G 8mm tapes or 4G 4mm tapes.

-----cut here----------------------
#!/bin/sh
# This script does a level 0 dump of a small Solaris filesystem
# To restore, you must skip over N EOF marks with mt -f /dev/nfoo fsf N
# and type tar xvf /dev/foo <files...>

partitions=`df -k |
sed -e 1d -e 's/^.*%[       ]*//' -e '/.*:/d' \
-e '/\/dev/d' -e '/\/tmp/d' -e '/\/proc/d'`

mt -f /dev/nrst34 rew
if [ $? -ne 0 ]; then
 echo "$0: Please insert a tape in the DAT drive (for nightly backup)" | wall
 sleep 300
 exec $0
fi

{
for i in $partitions; do

normalized=`echo $i | sed -e 's/\//\\\\\//g'`
exclude=`echo $partitions | sed -e 's/'${normalized}'//'`
 if [ ! "$i" = "/" ]; then
     exclude=`echo $exclude | tr ' ' '\012' | grep "^${normalized}\/"`
    else
     exclude=" --exclude $exclude --exclude /proc --exclude /dev --exclude /tmp"
 fi
 exclude=`echo $exclude | sed -e 's/[   ][      ]*/ --exclude /g'`
 if [ ! -z "$exclude" ]; then
    exclude=" --exclude $exclude"
 fi

 date
 echo "Running: gnutar zcf /dev/nrst34 $i $exclude"
 gnutar -z -c -f /dev/nrst34 $i $exclude
 if [ $? -ne 0 ]; then
        echo "Dump of $i failed"
    else
        echo "Dump of $i completed with no errors"
        echo ""
 fi

done

Quote:} 2>&1 | /usr/ucb/mail -s 'Nightly backup report' root

mt -f /dev/nrst34 offline
exit 0
-----------cut here-----------------
 
 
 

a script for nightly backups

Post by Jochen Be » Sat, 17 Sep 1994 11:39:02



Quote:>The following is a fairly general script that can be used to back up
>relatively small file systems at night (you can put it in your crontab).
>It is specific to Solaris and requires only minor customizations.
>I hope that you find it useful. Otherwise, please skip this article
>and don't flame me. Recommended media: 5G 8mm tapes or 4G 4mm tapes.

Aaah nah. Not flaming. Just some Remarks ...

Quote:># This script does a level 0 dump of a small Solaris filesystem
># To restore, you must skip over N EOF marks with mt -f /dev/nfoo fsf N
># and type tar xvf /dev/foo <files...>

A "Level 0 dump" to be restored with tar ... >:->

Quote:>mt -f /dev/nrst34 rew
>if [ $? -ne 0 ]; then
> echo "$0: Please insert a tape in the DAT drive (for nightly backup)" | wall
> sleep 300
> exec $0
>fi

On one Hand, you want to do a Backup, which means that you'ld like the
FSes to be quiescent. OTOH, if the Operator happens to have forgotten
the Tape, you'ld like Users around which can be notified.

Quote:>mt -f /dev/nrst34 offline

Make that a "rewoffl" on the rewinding Device, just in Case.

Two Ideas I've heard of (but haven't gotten around to implement them
myself): a) make the first File on the Tape a Header telling you
when what was written where on the Tape, b) verify that the Data on
the Tape is in Fact usable. Anybody having these two available ... ?

Regards,
                                                                        J. Bern
--

/ J. \ <A HREF="http://www.informatik.uni-trier.de/~bern">My Homepage</A> /  \
\Bern/ FINGER, NEWS ETC. AT THIS SITE ARE BROKEN, PLEASE USE MAIL (+ WWW) \  /
 \  /  P.O. Box 1203, 54202 Trier, Germany, Europe - Ham Call Sign: DD0KZ  \/

 
 
 

1. nightly backups

I'm trying to write a shell script wh ich does nightly backups
to the hard disk to be written to mag tape later.
I'd like to run it from the crontab.  Question, is there a way to
generate a sequence of filenames for each dump.  I.E. :
level9.mon, level9.tues, level9.wed, etc.  Or is there a better way?
Does any one do anything like this?

thanks in advance

Clarence Johnson
(new at this)
TRW inc.

2. Compling INND1.4sec on pre2.0.7

3. Nightly Backups

4. Sub-system problem

5. How do I setup the cron jobs for a nightly backup?

6. Old 3Com board settings

7. Nightly Backup Solution

8. ppp-on script help

9. Consistency Checks, Nightly Scripts, etc.

10. Solstice Backup (4.2.x): to run a script before/after backup

11. afio backup scripts incremental backup problem

12. A backup script and backup strategies for linux/Unix

13. Help - Looking For Backup Scripts - Backup 1.0 Problems