MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / del_crontab

Method del_crontab

mod/project/java/projectMod.py:3371–3388  ·  view source on GitHub ↗

@name 删除项目日志切割任务 @auther hezhihong<2022-10-31> @return

(project_name: str)

Source from the content-addressed store, hash-verified

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:

Callers 1

multi_remove_projectMethod · 0.95

Calls 8

DelCrontabMethod · 0.80
crontabMethod · 0.80
ExecShellMethod · 0.80
formatMethod · 0.45
selectMethod · 0.45
whereMethod · 0.45
MMethod · 0.45
getFieldMethod · 0.45

Tested by

no test coverage detected