From 22788f3a7a0b433d80c54a272e40c581ae5eddbb Mon Sep 17 00:00:00 2001 From: Prabuddha Chakraborty Date: Mon, 21 Dec 2015 20:06:23 +0530 Subject: [PATCH] fix python-crontab issue --- ee/core/cron.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/ee/core/cron.py b/ee/core/cron.py index ced77e54..6691c2a3 100644 --- a/ee/core/cron.py +++ b/ee/core/cron.py @@ -4,21 +4,22 @@ from ee.core.logging import Log """ Set CRON on LINUX system. -https://pypi.python.org/pypi/python-crontab """ class EECron(): def setcron_daily(self,cmd,comment='Cron set by EasyEngine',user='root',min=0,hour=12): if not EEShellExec.cmd_exec(self, "crontab -l | grep -q \'{0}\'".format(cmd)): - tab = CronTab(user=user) - cron_job = tab.new(cmd, comment=comment) - cron_job.minute.on(min) - cron_job.hour.on(hour) - #writes to crontab - tab.write() - Log.debug(self, "Cron is set:\n" + tab.render()) - else: - Log.debug(self, "Cron already exist") + #0 12 * * * ee site update phpbreddddcamp.net --le=renew --min_expiry_limit 30 2> /dev/null # Renew letsencrypt SSL cert. Set by EasyEngine + + EEShellExec.cmd_exec(self, "/bin/bash -c \"crontab -l " + "2> /dev/null | {{ cat; echo -e" + " \\\"" + "\\n*/0 12 * * * " + "{0}".format(cmd) + + " # {0}".format(comment)+ + "\\\"; }} | crontab -\"") + Log.debug(self, "Cron set") + def remove_cron(self,cmd):