Skip to content

Commit

Permalink
Merge branch 'ImUrX-more-scheduled-jobs'
Browse files Browse the repository at this point in the history
  • Loading branch information
flozz committed Dec 12, 2024
2 parents a8ba0e9 + a337e4f commit f695108
Show file tree
Hide file tree
Showing 9 changed files with 132 additions and 10 deletions.
13 changes: 13 additions & 0 deletions debian/clear-old-sync-logs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

export DOTENV_PATH=/etc/opt/pontoon.env
export LANG=c

cd /opt/pontoon/current
source __env__/bin/activate

python manage.py clear_old_sync_logs

deactivate
13 changes: 13 additions & 0 deletions debian/clear-sessions.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

export DOTENV_PATH=/etc/opt/pontoon.env
export LANG=c

cd /opt/pontoon/current
source __env__/bin/activate

python manage.py clearsessions

deactivate
13 changes: 13 additions & 0 deletions debian/collect-insights.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

export DOTENV_PATH=/etc/opt/pontoon.env
export LANG=c

cd /opt/pontoon/current
source __env__/bin/activate

python manage.py collect_insights

deactivate
13 changes: 13 additions & 0 deletions debian/send-deadline-notifications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

export DOTENV_PATH=/etc/opt/pontoon.env
export LANG=c

cd /opt/pontoon/current
source __env__/bin/activate

python manage.py send_deadline_notifications

deactivate
13 changes: 13 additions & 0 deletions debian/send-review-notifications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

export DOTENV_PATH=/etc/opt/pontoon.env
export LANG=c

cd /opt/pontoon/current
source __env__/bin/activate

python manage.py send_review_notifications

deactivate
13 changes: 13 additions & 0 deletions debian/send-suggestion-notifications.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

export DOTENV_PATH=/etc/opt/pontoon.env
export LANG=c

cd /opt/pontoon/current
source __env__/bin/activate

python manage.py send_suggestion_notifications

deactivate
13 changes: 13 additions & 0 deletions debian/warmup-cache.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

set -e

export DOTENV_PATH=/etc/opt/pontoon.env
export LANG=c

cd /opt/pontoon/current
source __env__/bin/activate

python manage.py warmup_cache

deactivate
49 changes: 40 additions & 9 deletions manual/install/cron.rst
Original file line number Diff line number Diff line change
@@ -1,31 +1,62 @@
Automatic Synchronization (cron)
--------------------------------
Scheduled Tasks (cron)
======================

To enable automatic synchronization, we will use cron.
Tu automatically run scheduled tasks we will use cron.

To configure this, first, login as ``pontoon``::
To configure them, first, login as ``pontoon``::

su pontoon

then edit the cron configuration using the following command::

crontab -e

You just have to call the `debian/sync-projects.sh
Once done, you can leave from the ``pontoon`` shell using the ``exit`` command.


Automatic Synchronization
-------------------------

To enable automatic synchronization you just have to call the `debian/sync-projects.sh
<https://github.com/wanadev/pontoon-debian/blob/master/debian/sync-projects.sh>`__
script at the desired interval. For example, you can add the following line to
run the synchronization every hour::
script at the desired interval.

For example, you can add the following line to run the synchronization every
hour::

0 * * * * /opt/pontoon/current/debian/sync-projects.sh

For more information, read `the crontab documentation
<https://www.man7.org/linux/man-pages/man5/crontab.5.html>`__.

Once done, you can leave from the ``pontoon`` shell using the ``exit`` command.

.. NOTE::

If you installed Pontoon in at a custom location or if your *virtualenv* is
not named ``__env__``, you will have to modify the `debian/sync-project.sh
<https://github.com/wanadev/pontoon-debian/blob/master/debian/sync-projects.sh>`_
script.


Other scheduled tasks
---------------------

You can also fetch other tasks mentioned on the `Pontoon documentation
<https://mozilla-pontoon.readthedocs.io/en/latest/admin/deployment.html#scheduled-jobs>`__.
A script is provided for each tasks:

* ``debian/clear-old-sync-logs.sh``
* ``debian/clear-sessions.sh``
* ``debian/collect-insights.sh``
* ``debian/send-deadline-notifications.sh``
* ``debian/send-review-notifications.sh``
* ``debian/send-suggestion-notifications.sh``
* ``debian/warmup-cache.sh``

For example, to have insights be fetched at the start of each day::

0 6 * * * /opt/pontoon/current/debian/collect-insights.sh

.. NOTE::

If you installed Pontoon in at a custom location or if your *virtualenv* is
not named ``__env__``, you will have to modify the scripts!
2 changes: 1 addition & 1 deletion manual/install/requirements.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Requirements
------------
============

To install Pontoon, you will need:

Expand Down

0 comments on commit f695108

Please sign in to comment.