Login to a list of linux nodes and execute a command

Put all hostname Ip address in the hosts.text file-

for x in `cat hosts.txt`; do echo $x; ssh -t $x “mysqlcheck -uroot -paSSw0rd -A –auto-repair –all-databases | grep -v OK”; done

It will ssh to all hosts and repair mariaDB database

Leave a Reply

Your email address will not be published. Required fields are marked *