- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Copying files from one server to another on regula...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 02:43 AM
03-09-2009 02:43 AM
I have an HP Unix 11.11 server let say server A and another server B. On hourly bases, i want to copy some friles created on server A, on to the server B. Can anyone tell me what would be the best method and how could i accomplish this taks.
1. On which server should i schedule the cron job?
2. Which command would i use in the script which will copy files from server A to the server B (ftp, scp etc).
3. How the script will look like which will perform this taks.
I am very new in HP so i am not sure how to do this.
Thanks
Salman
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 03:03 AM
03-09-2009 03:03 AM
Re: Copying files from one server to another on regular bases
I'd use scp to copy the files in question. If you are going to run it via cron you're going to need to setup authentication for the user doing the copy...
- logon to server A as the user who will initiate the copy
- if no ssh public keys exist in ~/.ssh or ~/.ssh2 then use ssh-keygen
- add the contents on the .pub key to the authorized_keys file on serverB:~/.ssh
- use scp to test the transfer works without a password (on serverA scp /path/to/file serverB:/path/to/destination)
if it works schedule it via cron
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 03:10 AM
03-09-2009 03:10 AM
Re: Copying files from one server to another on regular bases
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 03:19 AM
03-09-2009 03:19 AM
Re: Copying files from one server to another on regular bases
Files which you are going to copy is same everytime, rsync would be best option. It will update only the modifications instead of copying the entire file everytime.
Files are going to be different you can go for other options like scp, rcp . You need to setup passwordless logins for scp as specified by Richard.
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 03:34 AM
03-09-2009 03:34 AM
Re: Copying files from one server to another on regular bases
Your suggestion seems to be good in my environment. Can you please explain a bit about following two points
- if no ssh public keys exist in ~/.ssh or ~/.ssh2 then use ssh-keygen
How to perform this operation?
- add the contents on the .pub key to the authorized_keys file on serverB:~/.s
I also don't understand this, can you please explian this a bit.
To other people, thanks for your reply but i can't go for sync since every time files will be new.
Salman
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 03:47 AM
03-09-2009 03:47 AM
Solution- logon to serverA as user doing transfer
- ssh-keygen -t dsa
- cat ~/.ssh/id_dsa.pub (copy contents)
- logon to serverB as user doing transfer
- cd ~/.ssh
- vi authorized_keys (paste contents from key above)
regards,
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 04:05 AM
03-09-2009 04:05 AM
Re: Copying files from one server to another on regular bases
Other than generating public key and copy it to destination, you should set the proper permissions. Otherwise passwordless login will not work.
Make sure the following permissions are set in destination server(Server B in your case)
Home directory should have 755 permission (users home directory)
$HOME/.ssh directory should have 700 permission
$HOME/.ssh/authorized_keys file should have 600 permission
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 05:52 AM
03-09-2009 05:52 AM
Re: Copying files from one server to another on regular bases
cd $SYNC_DIR ; $RSYNC_BIN -avtz --rsync-path=$RSYNC_BIN --rsh="ssh -l $USER" . $DEST:$SYNC_DIR
Take a look at rsync docs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 11:42 PM
03-09-2009 11:42 PM
Re: Copying files from one server to another on regular bases
ssh-keygen is not present on my server. I tried to find out from the server but it is not there. What to do now and how to install this ssh-keygen so that i could go ahead.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-09-2009 11:53 PM
03-09-2009 11:53 PM
Re: Copying files from one server to another on regular bases
You can get ssh here:
http://h20293.www2.hp.com/portal/swdepot/displayProductInfo.do?productNumber=T1471AA
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 12:16 AM
03-10-2009 12:16 AM
Re: Copying files from one server to another on regular bases
ssh-keygen is secure shell command.
You need to find if you have installed secure shell product on your server.
#swlist |grep -i secure
#swlist |grep -i ssh
If it is not installed you can install HP ported Secure Shell or openssh which is avialble in net.
HP secure shell can be downloaded from above link.
openssh is here.
http://www.openssh.com/
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 12:36 AM
03-10-2009 12:36 AM
Re: Copying files from one server to another on regular bases
Thanks, its working, but very very very slow. Why? FTP is quite fast. Can i make it fast like FTP? On my LAN, the transfer rate is 3MB per second
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 12:42 AM
03-10-2009 12:42 AM
Re: Copying files from one server to another on regular bases
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 12:54 AM
03-10-2009 12:54 AM
Re: Copying files from one server to another on regular bases
scp, sftp are always going to be slower than ftp due to the encryption.
You can write an ftp script including user/passwd information but this is not the best policy security wise.
You can use this:
ftp -n server <
cd /directory
put file
bye
EOT
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 01:08 AM
03-10-2009 01:08 AM
Re: Copying files from one server to another on regular bases
IPADDR="192.168.2.1"
USERNAME="remoteuser"
PASSORD="remotepassword"
SOURCEFILE="/home/username/file"
DESTFILE="/home/remoteuser/file"
(
ftp -vin <
quote USER $USRNAME
quote PASS $PASSWORD
put $SOURCEFILE $DESTFILE
quit
END_SCRIPT
) | grep "226 Transfer complete." > /tmp/ftp$SRCFILE
The assignments for IPADDR, USERNAME, PASSWORD, SOURCEFILE and DESTFILE should be changed as appropriate. Please also note that the target directory structure needs to be in place (same restrictions as 'cp').
I would suggest that from a security point of view scp is a much better solution and should be used where possible.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 01:11 AM
03-10-2009 01:11 AM
Re: Copying files from one server to another on regular bases
Malcolm
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 10:33 PM
03-10-2009 10:33 PM
Re: Copying files from one server to another on regular bases
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2009 11:59 PM
03-10-2009 11:59 PM
Re: Copying files from one server to another on regular bases
Just create .rhosts in $HOME on the target server with:
sourceserver user
and then try rcp. With this in place it should not prompt for a password.
regards,
Richard
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-11-2009 12:53 AM
03-11-2009 12:53 AM
Re: Copying files from one server to another on regular bases
If your $HOME is over NFS, you can just list every machine in .rhosts with permission 600 and owner of the user:
machine1
...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 01:21 AM
03-12-2009 01:21 AM
Re: Copying files from one server to another on regular bases
Sourrce is ods
destination is devdb03
i have a user "oracle" on bother servers
i create .rhosts in /home/oracle/ which is home directory of user oracle and set permissions to 600. I created this on devdb03.
Now i am running rcp from ods-prim but facing error as follows.
$ rcp sqlnet.log devdb03:/home/oracle/
remshd: Login incorrect.
Please help thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 10:53 AM
03-12-2009 10:53 AM
Re: Copying files from one server to another on regular bases
Do you have both in .rhosts?
>i have a user "oracle" on both servers
Does it have the same numeric ID on both machines? Use: id
>I created this on devdb03.
What's in that file?
>$ rcp sqlnet.log devdb03:/home/oracle/
remshd: Login incorrect.
If your networking isn't set up correctly, you may have to use the FQDN and/or IP address in .rhosts.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2009 01:49 AM
04-03-2009 01:49 AM
Re: Copying files from one server to another on regular bases
+ +
(# Plus sign the space and then plus sign)
save file
and run the rcp command.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2009 03:49 AM
04-03-2009 03:49 AM
Re: Copying files from one server to another on regular bases
it is /home