From 2d509759e6f8b3a9bf994a45e4422530b1d9fa27 Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Wed, 29 Jan 2020 13:11:16 +0500 Subject: [PATCH] bug fix: permission issue with cron file --- websiteFunctions/website.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/websiteFunctions/website.py b/websiteFunctions/website.py index 203bd5da8..7517d8fd3 100755 --- a/websiteFunctions/website.py +++ b/websiteFunctions/website.py @@ -1326,6 +1326,18 @@ class WebsiteManager: CronUtil.CronPrem(0) + if ProcessUtilities.decideDistro() == ProcessUtilities.centos: + cronPath = "/var/spool/cron/" + website.externalApp + else: + cronPath = "/var/spool/cron/crontabs/" + website.externalApp + + if f.find('Permission denied') > -1: + command = 'chmod 644 %s' % (cronPath) + ProcessUtilities.executioner(command) + + command = 'chown %s:%s %s' % (website.externalApp, website.externalApp, cronPath) + ProcessUtilities.executioner(command) + if f.find("0,CyberPanel,") > -1: data_ret = {'getWebsiteCron': 0, "user": website.externalApp, "crons": {}} final_json = json.dumps(data_ret)