From 87fa02a49287fa03087a3f50258479e2974f9b8b Mon Sep 17 00:00:00 2001 From: root <root@zhangxuantong.ihep.ac.cn> Date: Fri, 6 Sep 2024 11:17:29 +0800 Subject: [PATCH] update remote bootstrap --- bootstrap_remote.sh | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/bootstrap_remote.sh b/bootstrap_remote.sh index db878f5..14881d0 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 -- GitLab