python linux 集群管理命令分发
import subprocess machines=["10.0.4.1", "10.0.4.2", "10.0.4.3", "10.0.4.4", "10.0.4.5", "10.0.4.6", "10.0.4.7", "10.0.4.8", "10.0.4.9", "10.0.4.10"] cmd = "hostname" for machine in machines: subprocess.call("ssh root@%s %s" % (machine,cmd),shell=True)