@name 删除项目日志切割任务 @auther hezhihong<2022-10-31> @return
(self, name)
| 2254 | # 日志切割 | |
| 2255 | #————————————— |
| 2256 | def del_crontab(self, name): |
| 2257 | """ |
| 2258 | @name 删除项目日志切割任务 |
| 2259 | @auther hezhihong<2022-10-31> |
| 2260 | @return |
| 2261 | """ |
| 2262 | cron_name = f'[勿删]Node项目[{name}]运行日志切割' |
| 2263 | cron_path = public.GetConfigValue('setup_path') + '/cron/' |
| 2264 | cron_list = public.M('crontab').where("name=?", (cron_name, )).select() |
| 2265 | if cron_list: |
| 2266 | for i in cron_list: |
| 2267 | if not i: continue |
| 2268 | cron_echo = public.M('crontab').where("id=?", (i['id'], )).getField('echo') |
| 2269 | args = {"id": i['id']} |
| 2270 | import crontab |
| 2271 | crontab.crontab().DelCrontab(args) |
| 2272 | del_cron_file = cron_path + cron_echo |
| 2273 | public.ExecShell("crontab -u root -l| grep -v '{}'|crontab -u root -".format(del_cron_file)) |
| 2274 | |
| 2275 | |
| 2276 | def add_crontab(self, name, log_conf, python_path): |
no test coverage detected