Skip to content
Permalink
Browse files
bug fix: cron path for ubuntu
  • Loading branch information
usmannasir committed Feb 11, 2020
1 parent d7b766c commit 0d54457db1b2e4d149bddaa77cf3c84dfbe8abc7
Showing 2 changed files with 11 additions and 5 deletions.
@@ -77,9 +77,12 @@ def remCronbyLine(externalApp, line):
@staticmethod
def addNewCron(externalApp, finalCron):
try:
CronPath = '/var/spool/cron/%s' % (externalApp)
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
cronPath = "/var/spool/cron/" + externalApp
else:
cronPath = "/var/spool/cron/crontabs/" + externalApp

with open(CronPath, "a") as file:
with open(cronPath, "a") as file:
file.write(finalCron + "\n")

print("1,None")
@@ -1548,11 +1548,14 @@ def addNewCron(self, userID=None, data=None):

website = Websites.objects.get(domain=self.domain)

CronPath = '/var/spool/cron/%s' % (website.externalApp)
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
cronPath = "/var/spool/cron/" + website.externalApp
else:
cronPath = "/var/spool/cron/crontabs/" + website.externalApp

commandT = 'touch %s' % (CronPath)
commandT = 'touch %s' % (cronPath)
ProcessUtilities.executioner(commandT, 'root')
commandT = 'chown %s:%s %s' % (website.externalApp, website.externalApp, CronPath)
commandT = 'chown %s:%s %s' % (website.externalApp, website.externalApp, cronPath)
ProcessUtilities.executioner(commandT, 'root')

CronUtil.CronPrem(1)

0 comments on commit 0d54457

Please sign in to comment.