Here is the text of the scripts that I use that works pretty well.  The backup script 
says what to dump.  The dodump script determines where it ends up by the BACKUPDIR 
variable.  I have this set up to a network share that goes to tape later but this 
could be anything.  This does full on Sunday and incremental the rest of the week.

Backup.sh:
#!/bin/sh

DODUMP=/root/DoDump.sh

if [ "$1" == "" ]; then
   DOW=`/bin/date +'%w'`
   # echo "WARNING: dump level suggested"
else
   DOW=$1
fi

echo "Backup: level=$DOW"
echo "        `/bin/date`"
echo ""

$DODUMP $DOW /
$DODUMP $DOW /home
$DODUMP $DOW /opt
$DODUMP $DOW /usr
$DODUMP $DOW /var
$DODUMP $DOW /boot

DoDump.sh:
#!/bin/sh

DODUMP=/root/DoDump.sh

if [ "$1" == "" ]; then
   DOW=`/bin/date +'%w'`
   # echo "WARNING: dump level suggested"
else
   DOW=$1
fi

echo "Backup: level=$DOW"
echo "        `/bin/date`"
echo ""

$DODUMP $DOW /
$DODUMP $DOW /home
$DODUMP $DOW /opt
$DODUMP $DOW /usr
$DODUMP $DOW /var
$DODUMP $DOW /boot

[root@Minerva root]#  more DoDump.sh
#!/bin/sh
#
# Usage: DoDump.sh <level> <fsmount>
#

if [ "$1" == "" ]; then
   echo "ERROR: dump level is missing"
   echo "Usage: DoDump.sh <level> <fsmount>"
   exit 1
fi
DUMPLEVEL=$1

if [ "$2" == "" ]; then
   echo "ERROR: file system mount point is missing"
   echo "Usage: DoDump.sh <level> <fsmount>"
   exit 1
fi
FSMOUNT=$2

BACKUPDIR=/mnt/backup-share
DIRNAME=`/bin/basename $FSMOUNT`

if [ "$DIRNAME" == "/" ]; then
   DIRNAME=root
fi

DUMPFILE=$BACKUPDIR/$DUMPLEVEL.dump.$DIRNAME.z

echo "  DUMP: $FSMOUNT ==> $DUMPFILE"

/bin/rm -f $DUMPFILE
/sbin/dump -$DUMPLEVEL -u -z -f $DUMPFILE $FSMOUNT

echo ""

--
Don Howard
Network Administrator
Connected Energy
Mailto:[EMAIL PROTECTED]
http://www.connectedenergy.com


 I have redhat 7.1 server.
  Because i have several dictories need to be backup, I want to write a
 script do it automatically  say every Satuerday a 2:00am. is there a way
 to do that?




-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to