| 524 | self.save_service_conf() |
| 525 | |
| 526 | def remove_service(self, sid: str) -> Optional[str]: |
| 527 | del_idx = None |
| 528 | for idx, i in enumerate(self.other_services): |
| 529 | if i["sid"] == sid: |
| 530 | del_idx = idx |
| 531 | break |
| 532 | |
| 533 | if del_idx is None: |
| 534 | return "未找到该服务" |
| 535 | del_conf = self.other_services.pop(del_idx) |
| 536 | self.save_service_conf() |
| 537 | log_file = os.path.join(SERVICE_PATH, '{}/{}.log'.format(self.project_name, del_conf["name"])) |
| 538 | pid_file = os.path.join(SERVICE_PATH, '{}/{}.pid'.format(self.project_name, del_conf["name"])) |
| 539 | if os.path.exists(log_file): |
| 540 | os.remove(log_file) |
| 541 | if os.path.exists(pid_file): |
| 542 | os.remove(pid_file) |
| 543 | |
| 544 | def _get_service_conf_by_sid(self, sid: str) -> Optional[Dict]: |
| 545 | for i in self.service_list: |