renamed to 'servicemanager'
the PYTHONPATH should be set to the directory above servicemanager
This commit is contained in:
25
seaman.py
25
seaman.py
@ -24,15 +24,15 @@ import sys
|
||||
import time
|
||||
import termios
|
||||
import subprocess
|
||||
from servman.base import ServiceManager
|
||||
from servman.sicsclient import sics_client
|
||||
from servicemanager.base import ServiceManager, ServiceDown
|
||||
from servicemanager.sicsclient import sics_client
|
||||
|
||||
|
||||
def run_command(cmd, wait=False):
|
||||
if wait:
|
||||
old = termios.tcgetattr(sys.stdin)
|
||||
proc = subprocess.Popen(cmd.split())
|
||||
try:
|
||||
proc = subprocess.Popen(cmd.split())
|
||||
proc.wait()
|
||||
except KeyboardInterrupt:
|
||||
proc.terminate()
|
||||
@ -47,6 +47,20 @@ def run_command(cmd, wait=False):
|
||||
class SeaManager(ServiceManager):
|
||||
group = 'sea'
|
||||
services = ('sea', 'graph')
|
||||
USAGE = """
|
||||
Usage:
|
||||
|
||||
sea gui <instance>
|
||||
sea <instance> # the same as sea gui <instance>
|
||||
sea cli <instance> (the same as old seacmd)
|
||||
sea start <instance> <service>
|
||||
sea restart <instance> [<service>]
|
||||
sea stop <instance> [<service>]
|
||||
sea list [<instance>]
|
||||
|
||||
<service> is one of main, stick, addons
|
||||
<instance> is one of %s
|
||||
"""
|
||||
|
||||
def do_cli(self, ins):
|
||||
try:
|
||||
@ -55,7 +69,7 @@ class SeaManager(ServiceManager):
|
||||
print('%s, try to start...' % e)
|
||||
self.do_start(ins)
|
||||
time.sleep(1) # make sure caller did read the message
|
||||
except KeyError as e: # running on an other machine?
|
||||
except KeyError: # running on an other machine?
|
||||
pass
|
||||
run_command('six -sea %s' % ins, wait=True)
|
||||
|
||||
@ -66,13 +80,12 @@ class SeaManager(ServiceManager):
|
||||
print('%s, try to start...' % e)
|
||||
self.do_start(ins)
|
||||
time.sleep(1) # make sure caller did read the message
|
||||
except KeyError as e: # running on an other machine?
|
||||
except KeyError: # running on an other machine?
|
||||
pass
|
||||
run_command('SeaClient %s' % ins)
|
||||
print('starting sea gui %s' % ins)
|
||||
time.sleep(5)
|
||||
|
||||
|
||||
def get_cfg(self, ins, service):
|
||||
"""return cfg info about running programs, if relevant
|
||||
|
||||
|
Reference in New Issue
Block a user