ben, o zaman tüm uzaktaki bilgisayar için grup eklemek çizgiyle ip_host.list satır oku deployAll.sh, yazma birden fazla uzak ana komut dosyalarını çalıştırmak başarısız: sh deployAll.sh<p></p> ben çalıştırdığınızda, ssh
sonuçları:
Group is added to 172.25.30.11
değil beklenen sonuçlar:
Group is added to 172.25.30.11
Group is added to 172.25.30.12
Group is added to 172.25.30.13
sadece ilk yürütmek Neden bir? lütfen yardım edin, çok teşekkürler!
deployAll.sh
#!/bin/bash
function deployAll()
{
while read line;do
IFS=';' read -ra ipandhost<<< "$line"
ssh "${ipandhost[0]}" "groupadd -g 1011 test"
printf "Group is added to ${ipandhost[0]}\n"
done < ip_host.list
}
deployAll
ip_host.listssh
komutu olmadan
172.25.30.11;test-30-11
172.25.30.12;test-30-12
172.25.30.13;test-30-13
Tuhaf, bana uyar. "Echo $ BASH_VERSION" sonucunu ve "bash -x deployAll.sh" komut dosyasını çalıştırdığınızda. – Coder256
Gerçekten Ansible projesine göz atmak istiyorsunuz: http://docs.ansible.com/ansible/quickstart.html –