|
|
|
|
@ -1,3 +1,26 @@
|
|
|
|
|
|
|
|
|
|
Per eseguire uno script su tutte i nodi possiamo utilizzare lo script di utilità:
|
|
|
|
|
```bash
|
|
|
|
|
#!/bin/bash
|
|
|
|
|
# Our custom function
|
|
|
|
|
file=$1
|
|
|
|
|
cust_func(){
|
|
|
|
|
echo "I am ${url}"
|
|
|
|
|
scp $file root@$url:/root/$file
|
|
|
|
|
ssh root@$url chmod +x /root/$file
|
|
|
|
|
ssh root@$url /root/$file
|
|
|
|
|
}
|
|
|
|
|
while IFS= read -r url
|
|
|
|
|
do
|
|
|
|
|
cust_func "$url $file" &
|
|
|
|
|
done < list.txt
|
|
|
|
|
|
|
|
|
|
wait
|
|
|
|
|
echo "All commands have been run."
|
|
|
|
|
```
|
|
|
|
|
seguito dal nome `script.sh` che vogliamo eseguire su tutte le macchine.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Script di configurazione iniziale del nodo
|
|
|
|
|
Script utilizzato per installare le macchine:
|
|
|
|
|
|
|
|
|
|
|