Skip to content

Instantly share code, notes, and snippets.

@cnsoft
Last active December 17, 2015 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cnsoft/5597375 to your computer and use it in GitHub Desktop.
Save cnsoft/5597375 to your computer and use it in GitHub Desktop.
Auto Start or Shutdown Testing Server
child = pexpect.spawn('su 3028')
child.expect(".word")
child.sendline("3028")
child.expect(".$")
child.sendline('cd ~')
child.sendline('/home/exe/mf204/bigworld/tools/server/control_cluster.py check')
r = child.expect([".not run",".run",pexpect.EOF])
if r == 0:
child.sendline('/home/exe/mf204/bigworld/tools/server/control_cluster.py load simple')
print 'try load server'
child.expect('.baseappmgr.')
else:
child.sendline('/home/exe/mf204/bigworld/tools/server/control_cluster.py stop')
print 'try stop server'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment