Skip to content

Commit 0d54457

Browse files
committed
bug fix: cron path for ubuntu
1 parent d7b766c commit 0d54457

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

plogical/cronUtil.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,12 @@ def remCronbyLine(externalApp, line):
7777
@staticmethod
7878
def addNewCron(externalApp, finalCron):
7979
try:
80-
CronPath = '/var/spool/cron/%s' % (externalApp)
80+
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
81+
cronPath = "/var/spool/cron/" + externalApp
82+
else:
83+
cronPath = "/var/spool/cron/crontabs/" + externalApp
8184

82-
with open(CronPath, "a") as file:
85+
with open(cronPath, "a") as file:
8386
file.write(finalCron + "\n")
8487

8588
print("1,None")

websiteFunctions/website.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1548,11 +1548,14 @@ def addNewCron(self, userID=None, data=None):
15481548

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

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

1553-
commandT = 'touch %s' % (CronPath)
1556+
commandT = 'touch %s' % (cronPath)
15541557
ProcessUtilities.executioner(commandT, 'root')
1555-
commandT = 'chown %s:%s %s' % (website.externalApp, website.externalApp, CronPath)
1558+
commandT = 'chown %s:%s %s' % (website.externalApp, website.externalApp, cronPath)
15561559
ProcessUtilities.executioner(commandT, 'root')
15571560

15581561
CronUtil.CronPrem(1)

0 commit comments

Comments
 (0)