def start(self,args): dir = args['dir'] port = int(args['port']) host = args['host'] #path,port = self._getPath(type, dir, port) print dir,port #print args if getPidByPort(port): print 'port is running' else: self._start(host, port, dir) return res(0,1)
def checkRun(self,args): port = args['port'] #print getPidByPort(port) if getPidByPort(port): #端口已存在!请重启 code = 1 else: #端口未启用 code = 0 #self.start(args) return res(0,code)
def startServer(self): php = os.path.join(self.config.dir['ptproject'],self.config.path['phpserver']) port = 8999 host = 'localhost' public = os.path.join(self.config.dir['ptproject'],self.config.dir['public']) ini_file = os.path.join(self.config.dir['ptproject'],self.config.path['phpserver_ini']) router_file = os.path.join(self.config.dir['ptproject'],self.config.path['phpserver_router']) if getPidByPort(port): killPidByPort(port) hostPort = "%s:%d" % (host,port) self.config.ptUrl = url = "http://" +hostPort cmd ="%s -S %s -c %s -t %s %s" % (php,hostPort,ini_file,public,router_file) print cmd subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)
def startServer(self): php = os.path.join(self.config.dir['ptproject'],self.config.path['phpserver']) port = int(self.config.setting['port']) host = self.config.setting['host'] public = os.path.join(self.config.dir['ptproject'],self.config.dir['public']) ini_file = os.path.join(self.config.dir['ptproject'],self.config.path['phpserver_ini']) router_file = os.path.join(self.config.dir['ptproject'],self.config.path['phpserver_router']) #如果 port 已启用 先KILL if getPidByPort(port): #print "port has runnint" killPidByPort(port) hostPort = "%s:%d" % (host,port) self.config.ptUrl = url = "http://" +hostPort cmd ="%s -S %s -c %s -t %s %s" % (php,hostPort,ini_file,public,router_file) subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)