【shell】【demo】expect连接主机,并在主机上执行shell脚本
【shell】【demo】expect连接主机,并在主机上执行shell脚本 【node_ips.txt】 10.10.0.17,root,AaBbCc 10.10.0.18,root,AaBbCc 【get_tree.sh】 #!/bin/bash typeset server_host=$1 typeset server_username=$2 typeset server_password=$3 typeset server_treefile_path=$4 typeset node_ip=`hostname -i" typeset NE_arr=("NODE1" "NODE2" "NODE _C" "NODE_D" "NODE_E") for NE in ${NE_arr[@]} do case ${NE} in "NODE_C") NE="NODE3" ;; "NODE_D") NE="NODE4" ;; "NODE_E") NE="NODE5" ;; *) echo "pls check the array NE_arr between node1 and node5" exit; esac typeset node_treefile_file="/tmp/treefile_${NE}.txt" typeset tree_param=phifsDug tree_user