[SWLUG] Backing up took 3 days
Steve Hill
steve at nexusuk.org
Tue Dec 6 09:17:06 UTC 2005
On Mon, 5 Dec 2005, James wrote:
> Someones also told me that the choice of flags are unusual, specifically the
> 'f' flag - "force file to be copied if the destination file cannot be opened"
> - that to me sounded like "if the destination file is corrupt, retry". Am I
> wrong in thinking like that? I read through the man pages but could not find
> what was wrong with the command.
When cp overwrites an existing file it does it by modifying the file which
is already there. If the destination file is an executable and is
currently executing you aren't allowed to modify it so that will fail.
the -f flag makes cp actually delete the existing file before overwriting
it and it is allowed to do that even if the file is executing (because
deleting files which are in use doesn't really remove them from the disk
until they have stopped being used).
I don't really see anything wrong with using -f on a backup <shrug>.
> I was also told that the cp command should copy all files which the ln
> command will see, with the same parameters. For example:
>
> ln -R /home/james/*
>
> Lists everything in my home directory, but:
>
> cp -fvr /home/james/*
>
> ignored anything beginning with a dot.
I assume you mean "ls -R /home/james/*" rather than "ln".
In any case, if "ls -R /home/james/*" is listing the dot-files in
/home/james then I don't know why because it shouldn't. The
"/home/james/*" bit is known as a glob and is expanded by the shell
itself, regardless of the command. You can do "echo /home/james/*" to see
what the shell expands it to, but the '*' wildcard never contains files
starting with a dot (at least, under Bash it doesn't, and that's almost
certainly the shell you're using). You could just backup /home/james
rather than /home/james/* since that would grab the directory and
everything inside it.
--
- Steve
xmpp:steve at nexusuk.org sip:steve at nexusuk.org http://www.nexusuk.org/
Servatis a periculum, servatis a maleficum - Whisper, Evanescence
More information about the Swlug
mailing list