GoodnGo.de (R) Zentrale wrote:
> Hello Bob, 
>  
> do this for tarring: 
>  
> #> cd /;tar -c -z -P -V `date` -B -p -f 
> /where_you_want_to_tar/file_to_tar.tar.gz  /var/qmail/users 
> /var/qmail/control /var/qmail/alias /home/vpopmail/domains -X Maildir new 
> cur & 

Thanks for the advice. I have a few questions...
Why -B [ reblock as we read (for reading 4.2BSD pipes)]?
How does "-X Maildir new cur" work? My manual page says -X means open the file 
given in the following argument, and use that as a list of patterns to ignore.

My script looks like this (sorry about any word wrap)...

#! /bin/sh

# Set up some variables
BACKUPLIST=./backup.include
EXCLUDELIST=./backup.exclude
DAILY=`date +%a`
DAILY=test
SQLBACK=/remotemount/sqldata.$DAILY.sql.z
FULLBACK=/remotemount/fullbackup.$DAILY.tar.z

# Dump the data to a ziped sql file
mysqldump -uroot -p<password> --add-drop-table --add-locks --lock-tables --
all-databases | gzip > $SQLBACK

# Tar all the essential config files, plus the documents into a compressed tar
tar cpPzf $FULLBACK --exclude-from $EXCLUDELIST `cat $BACKUPLIST`

The backup.include file contains a list of files and directories I want backed 
up. It looks a bit like this...

/etc/my.cnf
/etc/httpd/conf/httpd.conf
/etc/passwd
/etc/group
/usr/sbin/fw_iptables
/var/qmail
/home/vpopmail/domains
/var/www

The backup.exclude file contains a list of patterns not to back up. It looks 
like this...

*/logs/*
*/backups/*
*/.Trash/*
*/.Trash
*/qmail/man/*
*/qmail/doc/*
*/qmail/bin/*

Obviously, I've done it this way so that the include and exclude lists can 
easily be changed without too much danger of messing up the script.

-- 
Nikki Locke, Trumphurst Ltd.      PC & Unix consultancy & programming
http://www.trumphurst.com/


Reply via email to