@name 删除项目日志切割任务 @auther hezhihong<2022-10-31> @return
(self, name)
| 2854 | # 日志切割 | |
| 2855 | # ————————————— |
| 2856 | def del_crontab(self, name): |
| 2857 | """ |
| 2858 | @name 删除项目日志切割任务 |
| 2859 | @auther hezhihong<2022-10-31> |
| 2860 | @return |
| 2861 | """ |
| 2862 | cron_name = '[勿删]Python项目[{}]运行日志切割'.format(name) |
| 2863 | cron_path = public.GetConfigValue('setup_path') + '/cron/' |
| 2864 | cron_list = public.M('crontab').where("name=?", (cron_name,)).select() |
| 2865 | if cron_list: |
| 2866 | for i in cron_list: |
| 2867 | if not i: continue |
| 2868 | cron_echo = public.M('crontab').where("id=?", (i['id'],)).getField('echo') |
| 2869 | args = {"id": i['id']} |
| 2870 | import crontab |
| 2871 | crontab.crontab().DelCrontab(args) |
| 2872 | del_cron_file = cron_path + cron_echo |
| 2873 | public.ExecShell("crontab -u root -l| grep -v '{}'|crontab -u root -".format(del_cron_file)) |
| 2874 | |
| 2875 | def add_crontab(self, name, log_conf, python_path): |
| 2876 | """ |
no test coverage detected