Question on cp command - Unix

This is a discussion on Question on cp command - Unix ; Hi All, I have a script that runs daily that copies everything under / to a different backup drive. The actual command is this: cp -pxfR / /mnt/newroot/newcopy I am also running Postfix as my email server. I am running ...

+ Reply to Thread
Results 1 to 6 of 6

Thread: Question on cp command

  1. Question on cp command


    Hi All,

    I have a script that runs daily that copies everything under / to a
    different backup drive. The actual command is this:

    cp -pxfR / /mnt/newroot/newcopy

    I am also running Postfix as my email server. I am running into a
    problem, when this copy command executes, it reaches the postfix email
    queues (/var/spool/postfix) and I get an error about not being able to
    "stat" a file. I have no idea what that means.

    I can only think that maybe it was an email which at the time was
    there, then postfix sent it out and it is not there anymore, and the
    timing was such that the copy command was in the middle of copying the
    file or something.

    Anyhow, I was to exclude everything under /var/spool/postfix for this
    copy operation.......can that be done with cp?

    Thanks,

    Arthur


  2. Re: Question on cp command

    amerar@iwc.net wrote:

    > I have a script that runs daily that copies everything under / to a
    > different backup drive. The actual command is this:
    >
    > cp -pxfR / /mnt/newroot/newcopy
    >
    > I am also running Postfix as my email server. I am running into a
    > problem, when this copy command executes, it reaches the postfix email
    > queues (/var/spool/postfix) and I get an error about not being able to
    > "stat" a file. I have no idea what that means.
    >
    > I can only think that maybe it was an email which at the time was
    > there, then postfix sent it out and it is not there anymore, and the
    > timing was such that the copy command was in the middle of copying the
    > file or something.
    >
    > Anyhow, I was to exclude everything under /var/spool/postfix for this
    > copy operation.......can that be done with cp?


    .... sorry but 'cp' is not the right utility for backups:
    Have a look for example at 'rsync' ...
    PM

  3. Re: Question on cp command


    rsync seems to be mainly used for copying from one machine to another
    machine. In this case, the file systems are on the same machine, jsut
    different drives. One is external........

    Can I still use rsync for that?


  4. Re: Question on cp command

    amerar@iwc.net wrote:

    > rsync seems to be mainly used for copying from one machine to another
    > machine. In this case, the file systems are on the same machine, jsut
    > different drives. One is external........
    >
    > Can I still use rsync for that?


    Yep. man rsync

    --
    Erik Max Francis && max@alcyone.com && http://www.alcyone.com/max/
    San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
    Life is an effort that deserves a better cause.
    -- Karl Kraus

  5. Re: Question on cp command

    In article <1126144359.283082.13790@g14g2000cwa.googlegroups.c om>,
    amerar@iwc.net wrote:

    > Hi All,
    >
    > I have a script that runs daily that copies everything under / to a
    > different backup drive. The actual command is this:
    >
    > cp -pxfR / /mnt/newroot/newcopy
    >
    > I am also running Postfix as my email server. I am running into a
    > problem, when this copy command executes, it reaches the postfix email
    > queues (/var/spool/postfix) and I get an error about not being able to
    > "stat" a file. I have no idea what that means.


    "stat" is the system call that programs use to get attributes of a file.
    Since you specify the -p option to preserve attributes, cp has to stat
    each file it's copying.

    >
    > I can only think that maybe it was an email which at the time was
    > there, then postfix sent it out and it is not there anymore, and the
    > timing was such that the copy command was in the middle of copying the
    > file or something.


    More precisely, the file disappeared sometime after cp listed all the
    filenames in the directory.

    > Anyhow, I was to exclude everything under /var/spool/postfix for this
    > copy operation.......can that be done with cp?


    No.

    --
    Barry Margolin, barmar@alum.mit.edu
    Arlington, MA
    *** PLEASE post questions in newsgroups, not directly to me ***

  6. Re: Question on cp command

    amerar@iwc.net wrote:
    > rsync seems to be mainly used for copying from one machine to another
    > machine. In this case, the file systems are on the same machine, jsut
    > different drives. One is external........
    >
    > Can I still use rsync for that?
    >

    You can use it for any kind of backup, even on the same 'drive',
    you can make incremental backups (synchronizing and not
    just 'blind' copying), and rsync hast among others the
    magic option '--exclude', but as already stated:

    # man rsync

    is your start point.

    PM

+ Reply to Thread