diff --git a/bootstrap_remote.sh b/bootstrap_remote.sh index db878f5ce0ca70b24b9632f710099567423e4b14..14881d062302c3f2b7ff4255772cc0066b6464a7 100755 --- a/bootstrap_remote.sh +++ b/bootstrap_remote.sh @@ -1,13 +1,15 @@ #!/bin/bash -remote_command="cd ~; git -C .mysetting pull || git clone https://code.ihep.ac.cn/zhangxuantong/mysetting.git .mysetting; cd .mysetting; source bootstrap.sh git;" +remote_command="cd ~; \ + which git &>/dev/null || yum install -y git &>/dev/null; \ + git -C .mysetting pull || git clone https://code.ihep.ac.cn/zhangxuantong/mysetting.git .mysetting; \ + cd .mysetting; \ + source bootstrap.sh git;" host_list="src/hostlist.txt" -while IFS= read -r remote_host -do +for remote_host in $(cat src/hostlist.txt); do if [[ "${remote_host:0:1}" != "#" ]]; then echo "Executing on $remote_host ..." - ssh-copy-id root@$remote_host &>/dev/null - ssh root@$remote_host "$remote_command" + ssh-copy-id root@$remote_host && ssh root@$remote_host "$remote_command" echo "Finished $remote_host ..." fi -done < $host_list +done