Add a cron job for Mailman 3
This commit is contained in:
parent
c3836dd003
commit
62d9e34b8f
4 changed files with 31 additions and 1 deletions
23
roles/mailman/files/periodic.py
Executable file
23
roles/mailman/files/periodic.py
Executable file
|
@ -0,0 +1,23 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
from mailman.core.initialize import initialize
|
||||
from mailman.config import config
|
||||
from mailman.interfaces.pending import IPendings
|
||||
from mailman.interfaces.requests import IListRequests, RequestType
|
||||
from zope.component import getUtility
|
||||
|
||||
|
||||
def clean_pended():
|
||||
getUtility(IPendings).evict()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
if os.getuid() == 0:
|
||||
print("This script must be run as the mailman user", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
initialize(config_path="/etc/mailman.cfg")
|
||||
clean_pended()
|
||||
config.db.commit()
|
|
@ -193,7 +193,12 @@
|
|||
# Crontab
|
||||
#
|
||||
- name: set the hyperkitty crontab
|
||||
template: src=crontab.j2 dest=/etc/cron.d/hyperkitty
|
||||
template: src=crontab-webui.j2 dest=/etc/cron.d/hyperkitty
|
||||
tags:
|
||||
- config
|
||||
- mailman
|
||||
- name: set the mailman crontab
|
||||
template: src=crontab-mailman3.j2 dest=/etc/cron.d/mailman3
|
||||
tags:
|
||||
- config
|
||||
- mailman
|
||||
|
@ -367,6 +372,7 @@
|
|||
- pg-give-rights.py
|
||||
- post-update.sh
|
||||
- import-mm2.py
|
||||
- periodic.py
|
||||
|
||||
- name: copy the initial user fixture
|
||||
copy: src=postorius.initial-user.json
|
||||
|
|
1
roles/mailman/templates/crontab-mailman3.j2
Normal file
1
roles/mailman/templates/crontab-mailman3.j2
Normal file
|
@ -0,0 +1 @@
|
|||
42 * * * * mailman {{ mailman_webui_basedir }}/bin/periodic.py
|
Loading…
Add table
Add a link
Reference in a new issue