juanluisbaptiste / docker-otrs

The unofficial Znuny/OTRS Ticketing System docker image
https://www.juanbaptiste.tech/category/otrs
GNU Lesser General Public License v3.0
174 stars 105 forks source link

Attempt graceful shutdown of all processes #20

Closed Rillke closed 7 years ago

Rillke commented 7 years ago

Forward SIGTERM to all the processes running in the container, then exit.

Resolves #19

Rillke commented 7 years ago

I am by no means a UNIX or OTRS professional so please double-check.

Rillke commented 7 years ago

Okay, changes done, as requested :)

xxxx@xxxxx:~/otrs$ docker-compose exec otrs bash
[root@8f306c6e52e3 /]# ps aux
USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
root         1  0.0  0.0  11496  2584 ?        Ss   20:39   0:00 /bin/bash /run.sh
root        58  0.0  0.1  99164 15168 ?        S    20:39   0:00 /usr/bin/python /usr/bin/supervisord
root        61  0.0  0.2 231952 18644 ?        S    20:39   0:00 /usr/sbin/httpd -DFOREGROUND
root        62  0.0  0.0  20040  2436 ?        S    20:39   0:00 /usr/sbin/crond -n
root        63  0.0  0.0 247164  2700 ?        Sl   20:39   0:00 /sbin/rsyslogd -n
apache      68  2.0  3.0 543584 247308 ?       S    20:39   0:35 /usr/sbin/httpd -DFOREGROUND
apache      69  0.4  1.4 408792 118420 ?       S    20:39   0:07 /usr/sbin/httpd -DFOREGROUND
apache      70  0.9  1.6 430780 134776 ?       S    20:39   0:15 /usr/sbin/httpd -DFOREGROUND
apache      71  0.5  1.5 419152 126936 ?       S    20:39   0:09 /usr/sbin/httpd -DFOREGROUND
apache      72  1.0  1.5 420192 125760 ?       S    20:39   0:17 /usr/sbin/httpd -DFOREGROUND
apache      73  0.6  1.7 440080 145796 ?       S    20:39   0:10 /usr/sbin/httpd -DFOREGROUND
apache      74  0.7  1.8 447772 151352 ?       S    20:39   0:12 /usr/sbin/httpd -DFOREGROUND
apache      75  1.4  1.9 456352 161856 ?       S    20:39   0:23 /usr/sbin/httpd -DFOREGROUND
otrs        78  0.1  0.2  80304 24292 ?        S    20:39   0:01 /usr/bin/perl -X /opt/otrs/bin/otrs.Daemon.pl s
otrs        79  0.1  0.3 121244 32508 ?        S    20:39   0:02 /usr/bin/perl -X /opt/otrs/bin/otrs.Daemon.pl s
otrs        80  0.1  0.3 120716 31920 ?        S    20:39   0:02 /usr/bin/perl -X /opt/otrs/bin/otrs.Daemon.pl s
otrs        81  0.0  0.5 133920 41256 ?        S    20:39   0:00 /usr/bin/perl -X /opt/otrs/bin/otrs.Daemon.pl s
otrs        82  0.2  0.3 120848 32216 ?        S    20:39   0:04 /usr/bin/perl -X /opt/otrs/bin/otrs.Daemon.pl s
root        83  0.0  0.0   4160   508 ?        S    20:39   0:00 tail -f /dev/null
root       147  0.0  0.0  17008  1496 ?        Ss   21:01   0:00 /usr/sbin/anacron -s
root       157  0.7  0.0 108376  3140 ?        Ss   21:07   0:00 bash
root       171  0.0  0.0 110256  2372 ?        R+   21:08   0:00 ps aux
[root@8f306c6e52e3 /]# service supervisord stop
Stopping supervisord:                                      [  OK  ]
[root@8f306c6e52e3 /]# ps axl
F   UID   PID  PPID PRI  NI    VSZ   RSS WCHAN  STAT TTY        TIME COMMAND
4     0     1     0  20   0  11496  2584 do_wai Ss   ?          0:00 /bin/bash /run.sh
1   500    78     1  20   0  80304 24292 -      S    ?          0:02 /usr/bin/perl -X /opt/otrs/bin/otrs.Daemon.
5   500    79    78  20   0 121244 32524 -      S    ?          0:02 /usr/bin/perl -X /opt/otrs/bin/otrs.Daemon.
1   500    80    78  20   0 120716 31920 -      S    ?          0:03 /usr/bin/perl -X /opt/otrs/bin/otrs.Daemon.
5   500    81    78  20   0 133920 41272 -      S    ?          0:00 /usr/bin/perl -X /opt/otrs/bin/otrs.Daemon.
5   500    82    78  20   0 120848 32216 -      S    ?          0:06 /usr/bin/perl -X /opt/otrs/bin/otrs.Daemon.
0     0    83     1  20   0   4160   508 wait_w S    ?          0:00 tail -f /dev/null
5     0   147     1  20   0  19112  2032 sigsus Ss   ?          0:00 /usr/sbin/anacron -s
4     0   157     0  20   0 108376  3164 do_wai Ss   ?          0:00 bash
0     0   212   157  20   0 108148  2256 -      R+   ?          0:00 ps axl

anacron doesn't seem to be controlled by supervisord. We also installed spamassessin into that container but we are only using it as a client ...

anacron appears to be installed as part of the cronie package.

juanluisbaptiste commented 7 years ago

Merged. I'll look into putting anacron into supervisor control later.