unattended cpio backup script
Tim Brown
tim at comcon.UUCP
Sun Dec 16 04:56:11 AEST 1990
In article <28789 at usc>, mcitron at phad.hsc.usc.edu (Mark Citron) writes:
>
> find . -print | cpio -ocvB -K149000 > /dev/rct0 2> /usr/lbin/cpioback.log
>
> Do I have this backup script correct? Anything you would add?
>
> --
> Mark Citron
> mark at neurosci.usc.edu
I use tar. Have had no problems with it. I have had afio hang on me
tho. Anyway this is the backup script I use everyday.
Here is what I use:
# Backup 1.5 90/03/03 11:25:56
# tape backup script
PATH=$PATH:/usr/devbin:/etc
export PATH
case $1 in
-d)
delay=$2
;;
*)
delay=300
;;
esac
# notify any users
echo "
W A R N I N G !!!
A backup to tape will be started in five (5) minutes. You
will be logged off at that time if you are still here. This
is necesary so no data is lost, the backup goes as fast
as possible and the integrity of it is maximum. The system will
take calls again when it is finished.
Thank you.
Administration
"|wall
# wait five ....
sleep $delay
# switch passwd files
# this is something I added ... The programs in /etc/rc4.d are modeled
# after those in /etc/rc3.2 etc...
# I donot acutally change the run level, I played with that but now I
# substitute /bin/sh for /bin/bsh (a fake shell I wrote to echo a
# message and then drop the connection. The rc4.d programs also kill
# any users still logged in.
cd /etc/rc4.d
for i in K*
do
$i start
done
# backup the files to tape
cd /
echo Started tape backup at `date`|tee -a /usr/devbin/Backup.log >/dev/console 2>&1
# paths_to_back contains complete paths of top level directories I
# want backed up
tar cf - `cat /usr/devbin/paths_to_back`|compress |dd of=/dev/rmt0 obs=1024k >/dev/console 2>&1
if [ $? -eq 0 ]
then
echo Finished tape backup at `date` |tee -a /usr/devbin/Backup.log >/dev/console 2>&1
else
echo ERROR!!! Error during tape backup! `date` |tee -a /usr/devbin/Backup.log >/dev/console 2>&1
fi
tail -2 /usr/devbin/Backup.log|mail tim
# start system back up....
# put passwd back to normal, so it will allow logins.
cd /etc/rc4.d
for i in S*
do
$i stop
done
--
Tim Brown |
Computer Connection |
uunet!seaeast.wa.com!comcon!tim |
More information about the Comp.unix.sysv386
mailing list