Re: copy a bunch of rile, then delete from source
- From: Ugo Bellavance <ugob@xxxxxxxx>
- Date: Fri, 11 Apr 2008 08:43:25 -0400
Herta Van den Eynde wrote:
On 10/04/2008, Ugo Bellavance <ugob@xxxxxxxx> wrote:Hi,
Here is what I want to do:
- Copy a number of files (using a wildcard, like logapplication*.tar.gz)
from one server to another
- Once done, I want to delete the files from the source server.
The first step is easy to do... ssh keys, cronjob, and scp. However, can
I be sure that the file has been copied successfully? I thought of
comparing md5sums source/destination before deleting the source.
Could rsync be of help?
Regards,
Ugo
for i in logapplication*.tar.gz
do
scp -p $i user@remote-host:
if ((! $?))
then
rm $i
else
echo "copy of $I failed"
fi
done
$? is the return status of the previous command. If the scp is successful,
it will return 0.
0, somewhat contradictory, means "false" to an if-statement. Hence, "if ((!
$?))" = "if not false" = "if copy successful", remove the source file.
Thanks, but does the success of SCP ensure me that the file at destination is exactly the same as source (of course, the source file isn't changed).
Regards,
--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list
- References:
- copy a bunch of rile, then delete from source
- From: Ugo Bellavance
- Re: copy a bunch of rile, then delete from source
- From: Herta Van den Eynde
- copy a bunch of rile, then delete from source
- Prev by Date: Re: copy a bunch of rile, then delete from source
- Next by Date: Regarding creating 1 dvd from 3 red hat linux 9 cd's
- Previous by thread: Re: copy a bunch of rile, then delete from source
- Next by thread: Re: copy a bunch of rile, then delete from source
- Index(es):
Relevant Pages
|