日期:2014-05-16  浏览次数:20616 次

在linux上执行远程命令(ssh、ftp)

1、使用ssh在远程执行命令

ssh glassfish@192.166.63.51 /bin/sh <<\EOF
??????? cd ~
??????? source .bash_profile
??????? hostname
??????? echo $GLASSFISH_HOME
??????? $GLASSFISH_HOME/bin/asadmin stop-node-agent nodeagent1
EOF

注意: 使用ssh执行远程命令前,必须先使用ssh-keygen做好ssh信任相关配置

?

2、使用ftp执行远程操作

ftp 192.166.63.14 -n <

???? cmd

???? put test.file

???? get test.file.1

!