(15 risposte)
Chiuso 8 anni fa.
Come posso accedere a più host (ad es. host1, host2, host3, ecc.) e cat /etc/fstab
per generare report.txt
?
Risposta accettata:
Sì, puoi ssh hostname command
e reindirizza l'output al tuo report.txt
Il seguente script per ottenere questo rapporto da tutti i tuoi host. nomeserver.dat contiene tutti i nomi host.
#!/bin/sh
SERVERLIST=servername.dat
ICMD='cat /etc/fstab'
while read SERVERNAME
do
ssh -n $SERVERNAME $ICMD > $SERVERNAME_report.txt
done < "$SERVERLIST"