[nmglug] Linus would call it "bad taste".

Tim Emerick timothyemerick at yahoo.com
Wed Jun 9 08:07:49 PDT 2004


Hey all.

Well, I took a stab at writing my first and very ugly script to backup some
of my stuff on my server.  I could use some serious critiquing and or
hints/ideas. I am running it from cron every 3am using: 

/root/bin/backup > /backup/backup.log &

I have the following issues:

1. The output is sloppy but I didn't quite know how to make a comprehensive
log and sending the output to a log file was quick, dirty, and horrible.  I
would like a real log of the entire session as if I was at a terminal typing
everything in....maybe with the addition of a timestamp so I could see how
long things are taking.

2. The method that I use to grab a folder off of a WinXP machine are
inelegant at best.

3. I had originally sent the log to /backup/1/log but the script writes over
the old log before moving the directory it's in to a new location.  How can I
create a create the log in the /backup/1 directory without overwriting the
log file that's already there?

4. I or another user will probably use winzip to extract anything out of the
resulting backup.tgz file but winzip has a 4 gigabyte limit.  My backup file
has been around 16GB compressed.  Can tar/gzip split up these files into <4GB
chunks?

5. Here's the ugly mess in all it's glory:

#
# Backup Procedure.
#
# This backs up the /shares directory keeping a 2 day 
# live backup set for easy file recover via samba share.
# 3 additional days are kept as a .tgz file.

# I also added a backup for the pathways directory which is
# sitting on a winxp machine.  


# Remove the oldest Backup.
rm -f -r /backup/5

# Shift everything down a day but gzip/tar the 3rd days backup
mv /backup/4 /backup/5
mv /backup/3 /backup/4

mkdir /backup/3
cd /backup/2
tar cvzf /backup/3/backup.tgz .
cd /
rm -fr /backup/2

mv /backup/1 /backup/2

# Copy the shares folder to the backup directory
cp -a /shares/ /backup/

# rename to day 1
mv /backup/shares /backup/1

# also copy the /etc and /var directory
cp -a /etc/ /backup/1/etc/
cp -a /var/ /backup/1/var/

# and the CCC pathways data

mkdir /backup/1/pathways/
smbmount //v8701-pc40/pathways$ /mnt/smb -o
username=reliable/aig,password=password ro
cp -a /mnt/smb/* /backup/1/pathways
umount /mnt/smb



	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 




More information about the nmglug mailing list