@name 自动启动所有项目 @author hwliang<2021-08-09> @return bool
(self)
| 4310 | return public.returnMsg(True, "修改成功") |
| 4311 | |
| 4312 | def auto_run(self): |
| 4313 | ''' |
| 4314 | @name 自动启动所有项目 |
| 4315 | @author hwliang<2021-08-09> |
| 4316 | @return bool |
| 4317 | ''' |
| 4318 | project_list = public.M('sites').where('project_type=?', ('Java',)).field('name,path,project_config').select() |
| 4319 | get = public.dict_obj() |
| 4320 | success_count = 0 |
| 4321 | error_count = 0 |
| 4322 | for project_find in project_list: |
| 4323 | project_config = json.loads(project_find['project_config']) |
| 4324 | if project_config['auth'] in [0, False, '0', None]: continue |
| 4325 | project_name = project_find['name'] |
| 4326 | |
| 4327 | if project_config['java_type'] == 'springboot': |
| 4328 | project_state = self.get_project_run_state(project_name = project_name) |
| 4329 | elif project_config['java_type'] == 'duli': |
| 4330 | project_state = self.get_duli_run_state(project_name = project_name) |
| 4331 | else: |
| 4332 | get.project_name = project_name |
| 4333 | project_state = self.get_duli_run_state( |
| 4334 | project_name = project_name, |
| 4335 | bt_tomcat_web = '/usr/local/bttomcat/tomcat{}'.format( |
| 4336 | project_config['tomcat_version'] |
| 4337 | ), neizhi = True |
| 4338 | ) |
| 4339 | if not project_state: |
| 4340 | get.project_name = project_name |
| 4341 | result = self.start_project(get) |
| 4342 | if not result['status']: |
| 4343 | error_count += 1 |
| 4344 | error_msg = '自动启动Java项目[' + project_name + ']失败!' |
| 4345 | public.WriteLog(self._log_name, error_msg) |
| 4346 | else: |
| 4347 | success_count += 1 |
| 4348 | success_msg = '自动启动Java项目[' + project_name + ']成功!' |
| 4349 | public.WriteLog(self._log_name, success_msg) |
| 4350 | if (success_count + error_count) < 1: return False |
| 4351 | dene_msg = '共需要启动{}个Java项目,成功{}个,失败{}个'.format( |
| 4352 | success_count + error_count, success_count, error_count |
| 4353 | ) |
| 4354 | public.WriteLog(self._log_name, dene_msg) |
| 4355 | return True |
| 4356 | |
| 4357 | def get_jmap_path(self, project_find): |
| 4358 | ''' |
nothing calls this directly
no test coverage detected