查看postfix状态
✘ ⚡ root@dslab-pub / service postfix status
Redirecting to /bin/systemctl status postfix.service
● postfix.service - Postfix Mail Transport Agent
Loaded: loaded (/usr/lib/systemd/system/postfix.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 四 2020-05-14 10:51:57 CST; 4s ago
Process: 14545 ExecStart=/usr/sbin/postfix start (code=exited, status=1/FAILURE)
Process: 14542 ExecStartPre=/usr/libexec/postfix/chroot-update (code=exited, status=0/SUCCESS)
Process: 14538 ExecStartPre=/usr/libexec/postfix/aliasesdb (code=exited, status=0/SUCCESS)
Main PID: 20862 (code=killed, signal=TERM)
5月 14 10:51:57 dslab-pub systemd[1]: Starting Postfix Mail Transport Agent...
5月 14 10:51:57 dslab-pub postfix/postfix-script[14552]: fatal: the Postfix mail system is already running
5月 14 10:51:57 dslab-pub systemd[1]: postfix.service: control process exited, code=exited status=1
5月 14 10:51:57 dslab-pub systemd[1]: Failed to start Postfix Mail Transport Agent.
5月 14 10:51:57 dslab-pub systemd[1]: Unit postfix.service entered failed state.
5月 14 10:51:57 dslab-pub systemd[1]: postfix.service failed.
重启
✘ ⚡ root@dslab-pub / systemctl start postfix.service
Job for postfix.service failed because the control process exited with error code. See "systemctl status postfix.service" and "journalctl -xe" for details.
重启也失败了😭
解决方法:
HOW TO FIX:
The error to note here is the following:
fatal: open lock file /var/lib/postfix/master.lock
I first killed the smtp and smtpd processes that runs by postfix:
# killall -9 smtp
# killall -9 smtpd
But that didn’t solve the problem. I then used the fuser command to check which process holds the lock file:
# fuser /var/lib/postfix/master.lock
/var/lib/postfix/master.lock: 18698
Then we check the process 18698 and kill the responsible process:
# ps -axwww|grep 18698
9333 pts/0 S+ 0:00 grep --color=auto 1869818698 ? Ss 4:28 /usr/libexec/postfix/master -w
# killall -9 /usr/libexec/postfix/master
or
# kill -9 18698
Once the process is killed, you can now start the postfix:
# service postfix start
# service postfix status|grep Active
Redirecting to /bin/systemctl status postfix.service
Active: active (running) since Tue 2018-01-09 04:15:50 UTC; 4min 45s ago