28 lines
663 B
Python
Executable File
28 lines
663 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import time
|
|
from fabric import Connection
|
|
from fabric import task
|
|
from optparse import OptionParser
|
|
|
|
import serverlist_dev
|
|
|
|
def execCmd(svr_conf, cmd):
|
|
c = Connection(host=svr_conf['host'], user='root', connect_kwargs = {
|
|
'password': 'kingsome'
|
|
})
|
|
print(svr_conf)
|
|
c.run(cmd.replace('$server_id', str(svr_conf['server_id'])))
|
|
|
|
parser = OptionParser(usage="%prog [options]")
|
|
parser.add_option(
|
|
"-c",
|
|
"--cmd",
|
|
dest = "cmd",
|
|
help = "cmd"
|
|
)
|
|
(options, args) = parser.parse_args()
|
|
if options.cmd:
|
|
for a in map(lambda svr_conf : execCmd(svr_conf, options.cmd), serverlist_dev.server_list):
|
|
pass
|