Re: help with cpio
From: scriptOmatic (ScriptOmatic_at_ChironComputing.Com)
Date: 05/10/03
- Next message: Darren Tucker: "Re: Password Expiration Patch for openssh-3.6.1p2"
- Previous message: Dave Calhoun: "help with cpio"
- In reply to: Dave Calhoun: "help with cpio"
- Next in thread: Jeffrey Ross: "Re: help with cpio"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Date: Fri, 09 May 2003 23:52:48 GMT
Dave Calhoun wrote:
>
> Currently my nightly backup is done by calling a backup script from
> cron. That script get's it's variables from a config file and executes
> the following cpio command to do it's backup.
>
> find ${include_dirs[backup]} -print | cpio -ocmB > ${tape_dev[backup]}
>
> The problem is that sometimes I'd like to exclude certain directories.
> So I came up with:
>
> find ${include_dirs[backup]} -print | grep -v ${exclude_dirs[1]} | cpio
> -ocmB > ${tape_dev[backup]}
>
> Which seems like it would work, but doesn't allow me to specify multiple
> directories or files. Any ideas on how I could improve this?
>
> Thanks,
>
> Dave
Dave,
my personal experience with doing something like this is that the
quick fixes don't work. Especially with backup you want to be sure
that you get it right.
So typically what I do is this:
create a list of all those directories I want.
create a list of all those directories I do not want.
Diff the file, basically remove the send list from the first.
The list can be stored in files or in variables and then have the
script write the lists to temp file in /tmp/$$-[0-9] or some such
(see the code in ftp://ftp.opensysmon.com/pub/new/new.zip for
auto creation and removeal of temp files in scripts, FYI).
so, you sort the "dowant" file and sort the "nowant" file, then
use diff -e or grep -v to remove from the "dowant" file all directories
in the "nowant" file.
-- http://ftp.opensysmon.com is a shell script archive site with an open source system monitoring and network monitoring software package. Many platforms are supplied already compiled.
- Next message: Darren Tucker: "Re: Password Expiration Patch for openssh-3.6.1p2"
- Previous message: Dave Calhoun: "help with cpio"
- In reply to: Dave Calhoun: "help with cpio"
- Next in thread: Jeffrey Ross: "Re: help with cpio"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|