-
Notifications
You must be signed in to change notification settings - Fork 1
/
mailman3-web.service
42 lines (38 loc) · 1.43 KB
/
mailman3-web.service
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# It's not recommended to modify this file in-place, because it will be
# overwritten during package upgrades. If you want to customize, the
# best way is to use "override.conf" menthod
[Unit]
Description=GNU Mailing List Manager 3 Web UI
After=syslog.target network.target mailman3.service
ConditionFileNotEmpty=@ETCDIR@/gunicorn.conf.py
ConditionPathIsDirectory=@ETCDIR@
ConditionPathIsDirectory=@VARDIR@
Requires=mailman3.service
[Service]
PIDFile=@RUNDIR@/gunicorn.pid
User=@MMUSER@
Group=@MMUSER@
Environment="PYTHONPATH=@PYTHONPATH@"
ExecStart=@BINDIR_GUNICORN@/gunicorn -c @ETCDIR@/gunicorn.conf.py mailman_web.wsgi:application
KillSignal=SIGINT
TimeoutStartSec=150
# wait until listening port is up
ExecStartPost=/usr/bin/sh -c ' \
i=0; web=0; timeout=120; \
echo "GNU Mailing List Manager 3 Web UI daemon started, waiting $timeout sec for port listen: WEB(tcp/@WEBPORT@)"; \
while [ $i -lt $timeout -a $web -eq 0 ]; do \
if [ $web -eq 0 ]; then \
if /usr/sbin/ss -H -t -l -n sport = :@WEBPORT@ | grep -q "^LISTEN.*:@WEBPORT@"; then \
echo "GNU Mailing List Manager 3 Web UI daemon started, port listen after $i sec: WEB(tcp/@WEBPORT@)"; \
web=1; \
fi; \
fi; \
sleep 1; i=$[ i + 1 ]; \
done ; \
if [ $web -eq 0 ]; then \
echo "GNU Mailing List Manager 3 Web UI daemon started, missing port listen after $timeout sec: WEB(tcp/@WEBPORT@)"; \
fi; \
if [ $web -eq 0 ]; then exit 1; fi; \
'
[Install]
WantedBy=multi-user.target