send task logs to logfile

This commit is contained in:
sepehr 2025-01-28 16:11:33 +03:00
parent f2b59ea421
commit d6fbf23067

View file

@ -112,7 +112,7 @@ def user_tasks_create():
taskid=task.id taskid=task.id
crontab = CronTab(user=True) crontab = CronTab(user=True)
directory=Path(app.root_path).parent.absolute() directory=Path(app.root_path).parent.absolute()
command = "python3 {}/task_run.py {}".format(directory,taskid) command = "/usr/local/bin/python3 {}/task_run.py {} >> /var/log/cron.log 2>&1".format(directory,taskid)
comment = "MikroWizard task #" + "taskid:{};".format(taskid) comment = "MikroWizard task #" + "taskid:{};".format(taskid)
jobs = crontab.find_comment(comment) jobs = crontab.find_comment(comment)
if len(list(jobs)) > 0: if len(list(jobs)) > 0: