Here is a copy of our nightly backup script. When it says SOURCE=/, does that mean that the whole system gets backed up every night?
----------------------------------------------------------
# This Section is used to inhibit users, until backup completes
# The file 'signoff.msg' is a simple message telling users that
# the system will be starting a backup in 5 minutes, asking
# them to sigh off gracefully. The 'passwd.min' is a copy of the
# active passwd file, with the sers remove.Only system user ( lp, bin , etc.. )
# should be in it along with root. The passwd.all is of course a passwd
# file will alusers in it. The passwd is copied to the passwd.all each time
# the script is run ( usually from cron ) in case new users are added.
# *****************************************************************************
wall < /usr/bin/signoff.msg
sleep 300
who -u > /usr/bin/wlist
awk '{ print "kill -9",$7 }' /usr/bin/wlist > /usr/bin/tempkill
chmod 777 /usr/bin/tempkill
/usr/bin/tempkill
cp /etc/passwd /etc/passwd.all
cp /etc/passwd.min /etc/passwd
# *********************** Start of backup script ***************************
# Define global variables
TAPE=/dev/rStp0
SAVEDIR=/usr/bin/save
TMPFILE=${SAVEDIR}/tmpfile
TMPFILE2=${SAVEDIR}/tmpfile2
SOURCE=/
CONSOLE=/dev/tty01
# Find today's day
DAY=`date +%a`
# Check to see if it is Monday
if [ $DAY = Mon ]
then
# Skip backup, and do nothing
echo "It is Monday, and we don't do a backup on Mondays" | $CONSOLE
# fixpasswd re-copies the passwd.all, and sends a message
# to specific tty device ( terminals ) informing users to
# log back on... the the script exits with errorlevel 2
/usr/bin/fixpasswd
exit 2
else
# Proceed
:
fi
# Determine the names of today's list and log
LIST=${SAVEDIR}/${DAY}.list
LOG=${SAVEDIR}/${DAY}.log
# Log the fact that we just started
echo "\n\n\rBackup started on `date`\r" | tee $LOG | tee $CONSOLE
# Move to the root of the system
cd $SOURCE
# Create a list of all files to save
echo "Creating backup list... Please wait." | tee -a $LOG | tee $CONSOLE
if [ $DAYNAME = Sun ]
then
find . -print | sed 's/^\.\///' > ${LIST}
else
find ./etc -print | sed 's/^\.\///' > ${LIST}
find ./usr -print | sed 's/^\.\///' >> ${LIST}
fi
# Make sure the tape is reset and retensioned
echo "Resetting the tape ... Please wait." | tee -a $LOG | tee $CONSOLE
tape reset
sleep 10
echo "Starting cpio backup .. Please wait." | tee -a $LOG | tee $CONSOLE
# Use cpio to back up data from the current directory (.)
# Save the cpio output in the log file.
cpio -ocv -O${TAPE} < $LIST
# If cpio failed, declare an error
if [ $? -ne 0 ]
then
echo "\rSomething went wrong with cpio on `date`\r" | tee -a $LOG | tee $CONSOLE
mail root < $LOG
# fixpasswd copies the passwd.all to passwd allowing users back on
# It also sends a message to each specific active terminal
# to inform users to log back on. Then exits with errorlevel 1
/usr/bin/fixpasswd
exit 1
fi
/usr/bin/fixpasswd
# Verify the backup
echo "\rVerifying the backup on `date`\r" | tee -a $LOG | tee $CONSOLE
cpio -itc -I${TAPE} > $TMPFILE2
cat $TMPFILE2 | awk '{ print $1 }' > $TMPFILE 2>> $LOG
diff $TMPFILE $LIST >> $LOG
if [ $? -ne 0 ]
then
echo "\rBackup verification failed.\r" | tee -a $LOG | tee $CONSOLE
mail root < $LOG
/usr/bin/fixpasswd
exit 1
else
echo "\rBackup verification succeeded.\r" | tee -a $LOG | tee $CONSOLE
fi
# Clean up
sleep 5
tape reset # Reset tape to make sure it releases $TMPFILE
sleep 5
cat ${TMPFILE} >> $LOG
sync # Flush the buffers
sleep 2
# *************************************************************************
# fixpasswd copies passwd.all back to passwd to allow users to log back on
# It also send a message to specific tty devices informing users to log back on
#/usr/bin/fixpasswd
#rm -f ${TMPFILE}