From db17cd1dd3f0b39a8ea7836ff3692bb1bd7a603d Mon Sep 17 00:00:00 2001 From: Usman Nasir Date: Wed, 25 Mar 2020 12:00:32 +0500 Subject: [PATCH] bug fix cron on ubuntu --- install/install.py | 5 +++++ plogical/cronUtil.py | 4 ++++ plogical/upgrade.py | 4 ++++ 3 files changed, 13 insertions(+) diff --git a/install/install.py b/install/install.py index 6c06f5086..601717f68 100755 --- a/install/install.py +++ b/install/install.py @@ -1702,6 +1702,11 @@ imap_folder_list_limit = 0 cronFile.write(content) cronFile.close() + if not os.path.exists(CentOSPath): + command = 'chmod 600 %s' % (cronPath) + preFlightsChecks.call(command, self.distro, command, command, 1, 0, os.EX_OSERR) + + if self.distro == centos or self.distro == cent8: command = 'systemctl restart crond.service' else: diff --git a/plogical/cronUtil.py b/plogical/cronUtil.py index aa9f9ed2c..e2cde00da 100755 --- a/plogical/cronUtil.py +++ b/plogical/cronUtil.py @@ -85,6 +85,10 @@ class CronUtil: with open(cronPath, "a") as file: file.write(finalCron + "\n") + if ProcessUtilities.decideDistro() == ProcessUtilities.ubuntu: + command = 'chmod 600 %s' % (cronPath) + ProcessUtilities.executioner(command) + print("1,None") except BaseException as msg: print("0," + str(msg)) diff --git a/plogical/upgrade.py b/plogical/upgrade.py index e83c8831a..dfeba8cca 100755 --- a/plogical/upgrade.py +++ b/plogical/upgrade.py @@ -2133,6 +2133,10 @@ vmail writeToFile.write(content) writeToFile.close() + if not os.path.exists(CentOSPath): + command = 'chmod 600 %s' % (cronPath) + Upgrade.executioner(command, 0) + @staticmethod def upgrade(branch):