🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.next.sysadmin
Article #448

Re: dump and rdump - Round 2 (Scripts included)

#448
From: John Robison
Date: Wed, 12 Aug 1992 00:19
162 lines
4567 bytes
John Robison writes
> 
> Whenever I get this all figured out, I will post a few scripts.
>
OK, I got it figured out.
My configuration is a Sun server (Sun O.S. 4.1.1),
and a bunch of NeXTs.

You need a few things in place.
1) Correct .rhosts files
2) Tape device for your Sun
3) Modify the script to reflect your site's tape device
4) Create a file called backupHostList with a list of all the hostnames
of the computers you want backed up.

The script below (based largely on work by Irving Wolfe) runs on our
Sun and on a NeXT. You should run it on a Sun. I have *not* tested backing
up a Sun to a NeXT recently, but last time I tried it failed miserably.

(Note: pacific is the name of our Sun)

================
pacific# cd /usr/local/bin
/usr/local/bin
pacific# cat backupAllHosts
#!/bin/sh
#
# Automated tape backup script for backing up the entire Oceania
# network. This backup is placed on a single tape.
#
# Created by John Robison May 7, 1992
# Modified to work with Sun 4/330 on August 11, 1992
#
# NOTES
# 1) This script takes ONE argument. This argument is the correct
# "level" dump to perform.
#
# 2) This script uses the NeXT "dump" programs. They are 
# not compatible with Sun restore.
#
# 3) This script DUMPs all /dev/sd devices except /dev/sd1 devices.
# This is to avoid catching the swapdisk and removable opticals on NeXTs.
#
# 4) Modified to work with Sun 4/330 computer as the tapehost.
#

#
# Assume default parameters for other options
#
tapeLength=1250000 # Appx size to use for a 112m data tape.
tapeDevice=/dev/nrst1
tapehost=`/bin/hostname`

#
# Check for DUMP level parameter
#
if test x$1x = xx; then
  /bin/echo "Usage: $0 dumpLevel"
  exit 1
else
  dumpLevel=$1
fi

(
#
# Make sure a valid tape is ready. Then we can do the backups.
#
  if /bin/mt -f ${tapeDevice} rewind; then
    # Tape is inserted and ready to go!
    /bin/echo "Tape ready and re-wound, beginning backup."
  else
    /bin/echo "Rewind Failure, problem with tape"
    exit 1
  fi


#
# The following writes a "table of contents" for this tape.
# Easiest way to display date is each time through.
#
/bin/echo "Creating and writing a table of contents for this backup tape."
for hostToDo in `/bin/cat /usr/local/bin/backupHostList`
do
  /bin/echo
  /bin/echo `/bin/date`
  /bin/echo "Level ${dumpLevel} DUMP for the following..."
  for directory in `/usr/ucb/rsh ${hostToDo} -n /etc/mount | awk '! /:/ {  
print $1 }' | fgrep '/dev/sd' | fgrep -v '/dev/sd1'`
  do
    echo ${hostToDo}:${directory}
  done
done | dd of=${tapeDevice}

#
# Quick call to status to make sure command completes.
# This seems to flush buffers as well.
#
/bin/mt -f ${tapeDevice} status

#
# Define the "doDump()" function here. 
# All backup routines call this function.
#

dodump() {
  echo "" >&2
  echo "Starting ${hostToDo}:${directory}" >&2
  if test ${hostToDo} = ${tapehost}; then
    /usr/etc/dump ${dumpLevel}ufs ${tapeDevice} ${tapeLength} ${directory}
  else
    rsh ${hostToDo} -n "/usr/etc/rdump ${dumpLevel}ufs  
${tapehost}:${tapeDevice} ${tapeLength} ${directory}"
  fi
  echo "" >&2
}

#
# Here is the main "driver" function that runs all the backups
#
/bin/echo "Backing up all systems with a level ${dumpLevel} DUMP."
for hostToDo in `/bin/cat /usr/local/bin/backupHostList`
do
  for directory in `/usr/ucb/rsh ${hostToDo} -n /etc/mount | awk '! /:/ {  
print $1 }' | fgrep '/dev/sd' | fgrep -v '/dev/sd1'`
  do
    dodump
#
# Reports of dump commands getting errors, so do a quick
# Status call. This seems to flush the buffers as well.
#
    /bin/mt -f ${tapeDevice} status
  done
done

#
# Now we rewind the tape
#
/bin/echo "Backups done, rewinding tape..."
/bin/mt -f ${tapeDevice} rewind
echo Backup DUMP script is DONE `/bin/date` >&2

) </dev/null 2>&1

pacific# cat backupHostList
oceania
atlantic
aegean
southern
tasman
ontario
indian
pacific
============

Hope this helps others!

Regards,

John
-- 
John Robison - Oceania Health Care Systems 
john@oceania.com - NeXTMail Gladly Accepted
Technical Details
Message-ID: <BsuGwA.7C8@oceania.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!oceania!john
References: <BsttoA.493@oceania.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.sys.next.sysadmin
Path: arc1-ca.pugleaf.net!sparky!uunet!oceania!john
From: john@oceania.com (John Robison)
Subject: Re: dump and rdump - Round 2 (Scripts included)
Message-ID: <BsuGwA.7C8@oceania.com>
Sender: john@oceania.com (John Robison)
Reply-To: john@oceania.com
Organization: Oceania Health Care Systems
References: <BsttoA.493@oceania.com>
Date: Wed, 12 Aug 1992 00:19:22 GMT
Lines: 162