backup stratagems
Teodor Iliescu
tiliescu-ZdyLq7YhDA8hunQcOVOuvCwD8/FfD2ys at public.gmane.org
Wed Nov 5 14:20:52 UTC 2003
On Tue, 4 Nov 2003, David J Patrick wrote:
> What do you use ?
> ..discuss ..
Something I wrote. It works with cd-r's.
If you want to use cd-rws, just add blank=fast, in the cdrecord pipe.
Run it as root, of course.
------------------
#!/usr/bin/ksh
if [ "$USER" != "root" ]
then
echo You must be root to run this program!
exit 1
else
echo "You are logged in as root. Executing program."
sleep 1
fi
echo "Unmounting /dev/cdrom, if it is mounted:"
umount /dev/cdrom 2> /dev/null
echo "Starting backup..." >> log
echo "Backup started at" `date` by user $USER >> log
echo "Going up to /home/ directory"
cd /home
echo "Starting tarball, excluding oggs..."
tar czvf tiliescu-`date "+%A.%B.%d"`.tar.gz --exclude=*.ogg tiliescu | tee -a `date "+%A.%B.%d"`
mkdir backup
mv tiliescu-`date "+%A.%B.%d"`.tar.gz `date "+%A.%B.%d"` backup && echo "Moved files successfully to backup dir"
#Let's actually burn the data.
echo Starting real backup of data ; sleep 1
mkisofs -J -R /home/backup | cdrecord dev=0,0,0 speed=16 -eject -v - && echo "Burning of data successfull!"
if [ $? -eq 0 ]
then
cd -
echo Burning successfull! >> log
echo Burning finished at `date` >> log
else
cd -
echo Burning failed at `date` >> log
fi
#Let's do a little clean up.
rm -rf /home/backup
--------------------
--
Teodor I.
http://penguincomputing.iwarp.com
GPG key fingerprint : 9AC8 A05C 78AD AD73 91DB CBE4 B644 F402 FBFD 5927
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list