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

Method DelCrontab

class/crontab.py:1471–1488  ·  view source on GitHub ↗
(self, get)

Source from the content-addressed store, hash-verified

1469
1470 # 删除计划任务
1471 def DelCrontab(self, get):
1472 try:
1473 id = get['id']
1474 # 尝试删除数据库备份表中的数据
1475
1476 public.M("mysql_increment_settings").where("cron_id=?", (id)).delete()
1477 find = public.M('crontab').where("id=?", (id,)).field('name,echo').find()
1478 if not find: return public.returnMsg(False, '指定任务不存在!')
1479 if not self.remove_for_crond(find['echo'])['status']: return public.returnMsg(False, self.remove_for_crond(find['echo'])['msg'])
1480 cronPath = public.GetConfigValue('setup_path') + '/cron/' + find['echo']
1481 public.ExecShell("rm -rf {cronPath}*".format(cronPath=cronPath))
1482
1483 public.M('crontab').where("id=?", (id,)).delete()
1484 public.add_security_logs("删除计划任务", "删除计划任务:" + find['name'])
1485 public.WriteLog('TYPE_CRON', 'CRONTAB_DEL', (find['name'],))
1486 return public.returnMsg(True, 'DEL_SUCCESS')
1487 except:
1488 return public.returnMsg(False, 'DEL_ERROR')
1489
1490 # 从crond删除
1491 def remove_for_crond(self, echo):

Callers 15

set_cron_status_allMethod · 0.95
del_cron_taskFunction · 0.80
remove_crontabMethod · 0.80
remove_cron_jobMethod · 0.80
del_crontabMethod · 0.80
_update_ftp_log_pushFunction · 0.80
_update_ftp_user_pushFunction · 0.80
remove_crontabMethod · 0.80
del_crontabMethod · 0.80
del_crontabMethod · 0.80
del_crontabMethod · 0.80

Calls 9

remove_for_crondMethod · 0.95
returnMsgMethod · 0.80
ExecShellMethod · 0.80
deleteMethod · 0.45
whereMethod · 0.45
MMethod · 0.45
findMethod · 0.45
fieldMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected