@name 删除项目日志切割任务 @auther hezhihong<2022-10-31> @return
(project_name: str)
| 3369 | |
| 3370 | @staticmethod |
| 3371 | def del_crontab(project_name: str): |
| 3372 | """ |
| 3373 | @name 删除项目日志切割任务 |
| 3374 | @auther hezhihong<2022-10-31> |
| 3375 | @return |
| 3376 | """ |
| 3377 | cron_name = '[勿删]Java项目[{}]运行日志切割'.format(project_name) |
| 3378 | cron_path = public.GetConfigValue('setup_path') + '/cron/' |
| 3379 | cron_list = public.M('crontab').where("name=?", (cron_name,)).select() |
| 3380 | if cron_list: |
| 3381 | for i in cron_list: |
| 3382 | if not i: continue |
| 3383 | cron_echo = public.M('crontab').where("id=?", (i['id'],)).getField('echo') |
| 3384 | args = {"id": i['id']} |
| 3385 | import crontab |
| 3386 | crontab.crontab().DelCrontab(args) |
| 3387 | del_cron_file = cron_path + cron_echo |
| 3388 | public.ExecShell("crontab -u root -l| grep -v '{}'|crontab -u root -".format(del_cron_file)) |
| 3389 | |
| 3390 | def get_load_info(self, get): |
| 3391 | try: |
no test coverage detected