Answers for "run same command in different hosts"

0

run same command in different hosts

#!/bin/bash
USERNAME=someUser
HOSTS="host1 host2 host3"
SCRIPT="pwd; ls"
for HOSTNAME in ${HOSTS} ; do
    ssh -l ${USERNAME} ${HOSTNAME} "${SCRIPT}"
done
Posted by: Guest on August-18-2021

Code answers related to "Shell/Bash"

Browse Popular Code Answers by Language