Link to home
Start Free TrialLog in
Avatar of amd2002a
amd2002a

asked on

Script to copy files from one AIX server to another

I am looking for an easy script that I can use to copy all of the files and folders in a directory on one server to a directory on another server. The script will be run on the destination and will be invoked by an ANT script. The script can use ftp or any secure medium (scp etc.). Rsync is not an option because it is not installed on either server. The script should be able to accept username, password, server, destination folder, and source folder from the command line. Transfer must be done in binary mode (ftp). The first answer that works in my ant script will get the points. I'm not a AIX/Unix head so forgive me if any of my terminology is off.
ASKER CERTIFIED SOLUTION
Avatar of tfewster
tfewster
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of yuzh
yuzh

why not just simply use ssh + tar:

eg. copy files under /data in remote box to your local machine:

cd /backup-dir
ssh user@remote "(cd /data; tar cf - .) | tar xvf -

you can setup ssh login without password, or use "expect" to handle the job,
please have a look at:
http:Q_20473712.html

setup ssh without password:
http://linuxproblem.org/art_9.html
http://www.cvrti.utah.edu/~dustman/no-more-pw-ssh/
http://www.csua.berkeley.edu/ssh-howto.html
Ehm Greg, with that reasoning... what's wrong with scp directly?
scp -rp user@sourcehost:/path/to/source [possibly_user@destinationhost:]/path/to/destination
would perhaps be all that's needed:-). True, the source owner.group would not survive, but then, it's very possible that it woulödn't eb valid on destination anyway.

Or am I being unbearably dense here?

-- Glenn
Hi Glenn,

    It is personal preference. I prefer to use tar OVER cp/rcp/scp commands for backup files
it keep the file permisions, this will become very handy when you need to put the files back
to where it come from (restore!).
 
   >>"the source owner.group would not survive"
    the answer is "Yes" and "No", if the user ID is differ between two box, then the file
permission will not make much sense for the backup machine, if you need to tar it back
to the source machine it make sense.

    I used to NIS/NIS+ LDAP, it make sense in NIS/NIS+ LDAP ENV.

    BTW, if it is a on going backup, use rsync instead of tar, please have a look at:
    http://rsync.samba.org/

Good to see we agree (although reach slightly different results:) Greg. In this particular case the detour over tar isn't really necessary, but I generally would agree that tar is the better tool for storing backups;-).
Rsync was disqualified from the outset.

-- Glenn