Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SHELL

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
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #run #command #hosts
ADD COMMENT
Topic
Name
8+8 =