将本机的脚本在远程主机执行两种方式

61 阅读1分钟

将本机的脚本在远程主机执行两种方式

将本机编写的脚步在远程主机上执行,或者在远程主机上面执行本地的脚本

ssh连接远程主机执行

cat  /root/test2.sh
hostname  -I

ssh 10.0.0.6 bash < /root/test2.sh
10.0.0.6’s Password:

将远程主机上脚本在本机上运行

ssh 10.0.0.7  /data/test.sh
10.0.0.7’s Password:

web URL方式

curl 10.0.0.10/test.sh |bash