(self, get)
| 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): |
no test coverage detected