サーバA:Fedora Core 6 32bit
サーバB:Cent OS 5.8 32bit
サーバAにあるファイル群をサーバBにリネームしながら scp 転送するために、サーバB上の hoge.sh に
#!/bin/sh
scp (user)@A:(remote path) (local path)
:
のように scp コマンドを羅列して hoge.sh を実行しています。
全体で3000個ぐらいのファイルを転送したいのですが、何故か毎回先頭から1013個目でハングアップしてしまいます。
原因・解決方法がおわかりの方、回答をいただきたいです。
補足:
・hoge.sh はプログラムが自動で生成します。起動は手動です。
・サーバBからサーバAへは鍵認証で接続できるようになっています。
・転送するファイルの順番を変えても、ファイル名を変えても、毎回1013個目でハングアップしています。
・ハングアップした状態で、hoge.sh を Ctrl+C で抜けてコマンドプロンプトから手動で scp を叩いても、ハングアップします。
・再度サーバBにSSH接続しなおすと、また scp できるようになります。
・サーバAが Cent OS 5.8 でも同じ事象になります。
長すぎて質問本文の中に書けなかったことを補足します。
・ハングアップした時の scp -v で出たログは以下の通りです。SSH2_MSG_SERVICE_ACCEPT receivedで止まってしまっているようです。
$ scp -v -P (port) (user)@(domain):(remote path) (local path)
Executing: program /usr/bin/ssh host xxx.xxx, user xxx, command scp -v -f (local path)
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to xxx.xxx [xxx.xxx.xxx.xxx] port xxxxx.
debug1: Connection established.
debug1: identity file /home/xxx/.ssh/identity type -1
debug1: identity file /home/xxx/.ssh/id_rsa type -1
debug1: identity file /home/xxx/.ssh/id_dsa type 2
debug1: loaded 3 keys
debug1: Remote protocol version 1.99, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'xxx.xxx.xxx' is known and matches the RSA host key.
debug1: Found key in /home/xxx/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
CentOS側で ulimit -a してみてください。
デフォルトのままだと open files が 1024 になってるはずですから、
ulimit -n4096 などで変更して対応することになるでしょう。
CentOS側で ulimit -a してみてください。
デフォルトのままだと open files が 1024 になってるはずですから、
ulimit -n4096 などで変更して対応することになるでしょう。
ありがとうございます。この方法で無事解決できました。
ありがとうございます。この方法で無事解決できました。
2012/08/22 13:46:06