[Docker][Supervisor]spawned: ‘postfix’ with pid

LINEで送る
Pocket

  • OS
bash-4.3# cat /etc/os-release
NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.4.0
PRETTY_NAME="Alpine Linux v3.4"
HOME_URL="http://alpinelinux.org"
BUG_REPORT_URL="http://bugs.alpinelinux.org"
  • docker logs
2020-07-29 14:41:22,238 INFO exited: postfix (exit status 1; not expected)
2020-07-29 14:41:23,242 INFO spawned: 'postfix' with pid 10777
2020-07-29 14:41:24,245 INFO success: postfix entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
2020-07-29 14:41:24,256 INFO exited: postfix (exit status 1; not expected)
2020-07-29 14:41:25,260 INFO spawned: 'postfix' with pid 10784
  • /etc/supervisor/conf.d/app.conf
[supervisord]
nodaemon=true

[program:postfix]
command=/usr/sbin/postfix start
autostart=true
autorestart=true
stopsignal=TERM
user=root
bash-4.3# postconf | grep mail_version
mail_version = 3.1.1

上記の用にsupervisorでpostfixを起動するとpostfixプロセスが落ちたり立ち上がったりの繰り返しになる。ちなみにバージョンが3.3以上であれば postfix start-fg を使ってフォアグラウンドになるが、今回3.1ということもあるので、supervisorではシェルを起動し、起動されるシェルの方でpostfixの起動とFオプション月のtailコマンドでフォアグランド扱いとする方式に変更する必要がある。

  • /usr/local/bin/postfix.sh
#!/bin/sh
postfix start
tail -F /var/log/mail.log
  • /etc/supervisor/conf.d/app.conf
[program:postfix]
command=sh /usr/local/bin/postfix.sh
autostart=true
autorestart=true
stopsignal=TERM
user=root
bash-4.3# ps aux |grep post
    8 root       0:00 sh /usr/local/bin/postfix.sh
   93 root       0:00 /usr/lib/postfix/master -w
   94 postfix    0:00 pickup -l -t unix -u
   95 postfix    0:00 qmgr -l -t unix -u
  110 root       0:00 grep post

bash-4.3# tail -f /var/log/supervisord.log
2020-07-29 15:14:44,126 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2020-07-29 15:14:44,126 INFO supervisord started with pid 1
2020-07-29 15:14:45,132 INFO spawned: 'postfix' with pid 8
2020-07-29 15:14:46,288 INFO success: postfix entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)

Was this helpful?

0 / 0

コメントを残す 0

Your email address will not be published. Required fields are marked *