Exim provides a quick way to check the total number of mails in the queue. This is done using the
exim -bpc Although, this is not the same for postfix. Postfix doesn’t come with an easy way to do that.
How to Check Total Number of Mails in Postfix Queue
A quick tip on what I use to check the postfix queue number is the following command:
# mailq | tail -n 1
-- 6899 Kbytes in 1518 Requests.
Basically, postfix returns the queue statistics at the end of the queue listing command. We are simply tailing that to find the number.
If you are using Centos 7 or RHEL 7 or any of it’s variant, you are probably using ‘Firewalld’ by default. Although, if you are a iptables fan like me, who likes it’s simplicity and manipulative nature instead of a full form firewall, then you probably have disabled firewalld from your CentOS 7 instance and using iptables. There are couple of servers, where I use runtime iptables rules for postrouting and masquerading. These rules are dynamically generated by my scripts instead of the sysconfig file under:
This file is generated upon running the iptables save command:
service iptables save
which I rarely do so.
Which is why, I don’t have a /etc/sysconfig/iptables file in those servers and a common error I see while restarting iptables in those system is the following:
# systemctl restart iptables.service
Assertion failed on job for iptables.service.
How to Fix The Error
The error appears because you don’t have any rule in /etc/sysconfig/iptables or the file doesn’t exist either. You can ignore the error as iptables would still run. To eradicate the error, simply make sure you have some iptables rules loaded on your system using the status command:
And then, run:
service iptables save
Once done, restarting iptables shouldn’t show the error any longer.
Sometimes, you will see the error thrown in dmesg or /var/log/messages are mentioned in dm-number format, while you manage the disk using lvm logical volume name. This is because lvm logical volumes are designed through kernel device mapper technique and kernel recognizes volumes using dm numbers. There is a tool to list all the device mappers used for block devices under Linux. Simply type the following to list the maps:
It shall show something like the following:
There you can see the dm number for each lvm volume is listed under first bracket. For example the swap in this server is created with LVM with the name vg_iof442/swap and has the dm-1 mapping.