V1.30.6 cron settings

This commit is contained in:
Tibor Bossanyi (Freelancer) 2021-10-02 11:02:01 +02:00
parent 83736df898
commit 52212fb949
4 changed files with 4 additions and 3 deletions
Dockerfileaitrainer-cron
aitrainer_backoffice/controlling

View File

@ -5,7 +5,7 @@ RUN /usr/local/bin/python -m pip install --upgrade pip
RUN apt-get update && apt-get install vim -y
RUN apt-get -y install cron
# Copy cron file to the cron.d directory
COPY aitrainer-cron /etc/cron.d/hello-cron
COPY aitrainer-cron /etc/cron.d/aitrainer-cron
# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/aitrainer-cron

View File

@ -1 +1 @@
*/30 * * * * python /aitrainer_backoffice_aitrainer_backoffice/manage.py runcrons --settings aitrainer_backoffice.settings.deploy > /var/log/cronjob.log
*/5 * * * * python /aitrainer_backoffice/aitrainer_backoffice/manage.py runcrons --settings aitrainer_backoffice.settings.deploy >> /var/log/cronjob.log

View File

@ -8,6 +8,7 @@ class Notification:
fcm = FCM()
def run(self):
print("** Running Notification automation")
notification_queryset = notif.Notification.objects.using('live').raw('SELECT * from notification WHERE active = 1')
for notification in notification_queryset:

View File

@ -15,7 +15,7 @@ class MyCronJob(CronJobBase):
class NotificationJob(CronJobBase):
notif = Notification()
RUN_EVERY_MINS = 60
RUN_EVERY_MINS = 5
schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
code = 'aitrainer_backoffice.controlling.notification' # a unique code