#!/bin/ksh
#
#	Shell day save routine
#
#	by john quirk
#	Version 1.1 - /etc directory search "allowed" ( D.Diffey 15Jul95 )
#
#	This program uses the Time_Stamp created by the time_stamp program
#       which should be run after a total save.
if [ `puid` != 0 ]
	then
	echo This program must run as Admin
	exit
fi
lastsave
echo "Day save building list of files changed since last total save"
find / -type f -a "(" -time -`time_read -s </Time_Stamp` -o -time `time_read -s </Time_Stamp` ")" | match -not '/tmp' |match -not '.EDTMP' >/tmp/tempf.$$
echo 'Working out how large the save will be'
package -c bs=2000b -nr </tmp/tempf.$$ 2>/tmp/temp2.$$
tail -1 /tmp/temp2.$$
echo "Do you wish to see the files about to be saved ?"
read input
if test -z input
	then 
	input=n
fi
if [ $input = "y" ]
	then
	p /tmp/tempf.$$
fi
echo "Do you wish to continue with save ?"
read input
if test -z "$input"
	then
	input="n"
fi
if [ $input = "y" ]
	then
	echo 'Rewinding Tape'
	iostats -rewind /dev/rcs0 2>/dev/null
	package -nr -x bs=2000b /dev/rcs0 </tmp/tempf.$$
	iostats -rewind /dev/rcs0 2>/dev/null
	time_stamp -s >/Day_Save_Time
fi
delete /tmp/temp2.$$ /tmp/tempf.$$ 2>/dev/null
