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)

  

posted @ 2013-04-03 15:29  glose  阅读(379)  评论(0编辑  收藏  举报