#/bin/bash # Run this script to run the $command in all nodes coc-sshreachable > /dev/null ####### define your command here #command='/share/apps/local/bin/coc-adduser_local_explicit' command='reboot now' ####### end of define your command here #hosts=$(cat /share/tmp/ssh-reachable.dat | awk '{if ($1 != "192.168.1.10") print $1}' | awk '$1!= "anicca" ') hosts=$(cat /share/tmp/ssh-reachable.dat) echo 'available nodes are' $hosts echo ' ' for i in $hosts do echo entering node "$i" pdsh -R ssh -w "$i" "$command" echo '' done