From: gtw@arts.su.oz.au (Gilbert Taylor-Wood)
Subject: Re: Backup procedure sought
Keywords: Ultrix 4.3 backup dump tape date
Organization: Sydney University Computing Service, Sydney, NSW, Australia
Date: Thu, 24 Dec 1992 04:24:31 GMT

wes@dd.dk (Mads Westermann) writes:

>I need a backup procedure that (unattended) will bring the system
>into single-user mode, do a full or an incremental backup on *ONE* tape
>and then bring the system back into multi-user mode again. 

>Has anybody solved this problem ?? I'd very much appreciate if you
>could enlighten me on this subject.

Here is my solution. If anyone can improve on it I would like to know.

Happy Christmas

  Gilbert

Gilbert Taylor-Wood                          gtw@arts.su.edu.AU
Network Manager
Faculty of Arts A14                          Ph  +61 2 692 4713
The University of Sydney                     Fax +61 2 692 2045
NSW 2006
AUSTRALIA                    SysAdmin: The ghost in the machine


***
*** Put an entry in /etc/crontab to start this off.
***

0 1 * * 2,3,4,5,6 usr/bin/touch /tmp/DO_DUMP; shutdown -r 04:00 'System Backup'

***
*** Modify /etc/rc to include the following
***

[deleted stuff ]
	export DISKLESS
}

if test -f /tmp/DO_DUMP
then 
        DO_DUMP=true
        FSCK_OPTS=-n
        rm -f /tmp/DO_DUMP
else
        FSCK_OPTS=-p
fi

/etc/startcpu 	>/dev/console

date >/dev/console
if [ $1x = autobootx ]
then
	echo Automatic reboot in progress... >/dev/console
	/etc/fsck $FSCK_OPTS >/dev/console
	case $? in
	0)
	 	;;
[stuff deleted]
fi
#
# After successful fsck do backup if necessary
if test $DO_DUMP = true
then
	/bin/sh /etc/full_dump
	if test $? -ne 0 
	then
		DUMP_STATUS=FAILED
	else
		DUMP_STATUS=succssfull
	fi
fi

[More deleted stuff that brings the system up to Multi-User ]

sh /etc/rc.local 
				echo 'preserving editor files' 	>/dev/console
(cd /tmp; /usr/lib/ex3.7preserve -a)
#
# Mail results of Dump to root
#
if test $DO_DUMP = true
then
    cat /tmp/full_dump.LOG | /usr/ucb/mail -u daemon \
        -s "$DUMP_STATUS dump of Plato" root
fi
				echo clearing /tmp		>/dev/console
(cd /tmp; rm -f *; chmod 1777 /tmp)

[finish off.... ]

***
*** /etc/full_dump looks like
***


#!/bin/sh
#
# This script is tailored for plato
#
cd /etc
USER=daemon
NICE=-15
# On plato(two drives) /dev/nrmt1? is scsi tz (DAT) drive
OUTDEV=/dev/nrmt1h
FLAG=
#LENGTH for tz SCSI tape drive(WangDat) is 60m(90Min)/90m(120min) (60m=195ft)
#DENSITY for tz SCSI tape drive(WangDat) is 61000bpi Uncompressed (90m=292ft)
# Fake the length to get the calculations to work.
LENGTH=1818
DENSITY=61000
STATUS=good
DONE=
PROG=`basename $0`
LOG=/tmp/${PROG}.LOG
LIST="root users local usr var aufs0 aufs1 "
for NAME in $LIST
do
	case $NAME in
		root|/)		DRIVE=rz3a
		usr|/usr)	DRIVE=rz3d
		local|/local)	DRIVE=rz3e
		users|/u0)	DRIVE=rz3f
		aufs1)		DRIVE=rz3g
		aufs0)		DRIVE=rz2d
		var)		DRIVE=rz2a
		*)		echo $PROG: unrecognised filesystem
	esac
	KEY=0
        TYPE=full

	echo "File System $NAME $TYPE dump" > /dev/colsole
	echo "File System $NAME $TYPE dump" >> $LOG
	/etc/dump "$KEY"ufsd"$FLAG" $OUTDEV $LENGTH $DENSITY \
		/dev/r"$DRIVE" >> $LOG 2>&1

# exit status of dump is 1 for success on ultrix !
	if test $? = 1
	then
		DONE=$DONE" $DRIVE"
	else
		STATUS=bad
	fi
done
if test $STATUS = bad 
then
	exit 1
fi
mt -f $OUTDEV rewind	# was offline
exit 0
--
Gilbert Taylor-Wood                          gtw@arts.su.edu.AU
Network Manager
Faculty of Arts A14                          Ph  +61 2 692 4713
The University of Sydney                     Fax +61 2 692 2045
NSW 2006
AUSTRALIA                    SysAdmin: The ghost in the machine
Newsgroups: comp.unix.ultrix