Re: help with cpio

From: scriptOmatic (ScriptOmatic_at_ChironComputing.Com)
Date: 05/10/03


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.


Relevant Pages

  • Feedback on backup script
    ... The one problem I have is that the script keeps stopping at lines 633,635 and or 637 with the error "Path Not Found" I have emailed the original author for help but haven't heard back yet. ... I was just wondering if the problem could be that the account running the script doesn't have correct permissions to a share/directory/file that it's trying to backup? ... ' always one less than the actual number of folders. ... ' Show the user free space info on all available disk drives ...
    (microsoft.public.scripting.vbscript)
  • Re: Enterprise Manager Newbie Question
    ... a SQL backup is not a simple copy of the database files. ... Is it possible to write a script that one could run from a workstation and ...
    (microsoft.public.sqlserver.tools)
  • Re: xcopy and vbscript
    ... It takes about 5-6 minutes to backup approximately ... A copy of the script is below for reference. ... ObjShell.Popup strMessage, 5, "Backup Complete", OK_Button ... Dim sSrc, sDest ' as string ...
    (microsoft.public.scripting.vbscript)
  • Re: How do I move an account... A few more details... and more
    ... >> use this system as a backup system if the first ever goes down. ... >> rsync for this. ... >serv1 and the system you back up to is fs. ... >rsync script. ...
    (Fedora)
  • Re: Maintain backup directory
    ... When I run the script (after setting target to the right ... the backup media runs out of ... Remove the word "echo" from Line #18 to enable the file deletion. ...
    (microsoft.public.scripting.wsh)