Ejemplo n.º 1
0
def checkgateway():
    '''Once a minute the gateway is checked to see if it's running.'''
    print colored("Check the gateway is running", color='white')

    connection = Connection.get_latest()
    c = connection
    #log("Process Name    ", c.process_name)
    #log("Running         ", c.running())

    if c.running() is not True:
        #start it.
        log('Gateway is not running, attempt restart.', color='red')

        c = [sys.executable, 'manage.py', 'runscript', 'recurse']

        log('running command', c)

        subprocess.Popen(c, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)

        connection = Connection.get_latest()
        c = connection
        '''
Ejemplo n.º 2
0
def checkgateway():
    '''Once a minute the gateway is checked to see if it's running.'''
    print colored("Check the gateway is running", color='white')
    
    connection = Connection.get_latest()
    c = connection
    #log("Process Name    ", c.process_name)
    #log("Running         ", c.running())
    
    if c.running() is not True:
        #start it.
        log('Gateway is not running, attempt restart.', color='red')
        
        c = [sys.executable, 'manage.py', 'runscript', 'recurse']
        
        log('running command', c)
        
        subprocess.Popen(c,  stdout=subprocess.PIPE, 
                            stderr=subprocess.STDOUT)
        
        connection = Connection.get_latest()
        c = connection
        
        '''
Ejemplo n.º 3
0
 def handle(self, *args, **options):
     from amii.server.models import Connection
     self.con = Connection.get_latest()
     # Get the last running connection
     if con.running is not True:
         try:
             s = self.start()
         except KeyboardInterrupt:
             print "SERVER DID NOT START"
     
     # Check to see if it is running
         # If running
             # pass
         # else
             # start gateway
     print "Calling command"
Ejemplo n.º 4
0
    def handle(self, *args, **options):
        from amii.server.models import Connection
        self.con = Connection.get_latest()
        # Get the last running connection
        if con.running is not True:
            try:
                s = self.start()
            except KeyboardInterrupt:
                print "SERVER DID NOT START"

        # Check to see if it is running
        # If running
        # pass
        # else
        # start gateway
        print "Calling command"