Automate Your Stopped Zimbra CBPolicyD Service

Every day, i work with email servers. Maintain them and make sure they are running well. As a Zimbra Administrator, i can’t hope the email server running well every day. And they are stable continuously. Every administrator definitely have an experience that the services are stopped working. And it’s annoying.

One of the problem when i maintaining Zimbra is that the Zimbra CBPolicyD Stopped Working. Because it has a lot of traffic. And when the service is stopped, it makes your email bounce.

For that reason. Obviously, we need to upgrade the memory or CPU. To minimize the frequency stopped service.

Second, we must SSH to the server and manually start the service with. su - zimbra -c 'zmcbpolicyd start'

But, stopped service can come every time. When you work, you take a bath, or when you playing football, maybe. In that situation, we can’t SSH to our server and start the service manually. We need to automate it!

To do it, we can use …


Monit is open source software to automatically manage and maintain server process, file and services. It also can monitor your Zimbra services including cbpolicyd. But in this guide, i want to show how we can automating cbpolicyd server when the service is stopped.


You need to install monit, for CentOS you can use yum, or Ubuntu you can use apt or apt-get.

# For ubuntu:
apt install monit

# For CentOS

yum install monit

Then create a file to monitoring your cbpolicyd services on /etc/monit/conf-available/:

vi /etc/monit/conf-available/cbpolicyd

# Fill with the following script
check process cbpolicyd with pidfile /opt/zimbra/log/
   group zimbra
   start program = "/opt/zimbra/bin/zmcbpolicydctl start"
   as uid zimbra and gid zimbra
   stop  program = "/opt/zimbra/bin/zmcbpolicydctl stop"
   as uid zimbra and gid zimbra
   if failed port 10031 then restart

And make it linked to /etc/monit/conf-enabled/

ln -s /etc/monit/conf-available/cbpolicyd /etc/monit/conf-enabled/

Then, you can check the monit configuration with:

monit -t

If the result OK, you can start monit:

systemctl start monit

Now, try to stop your cbpolicyd services. And it will start automatically in 2 minutes.

Too long for 2 Minutes?

If you feel monit too long to start the services, you can set the time as you wish. For example, you can give an instruction to monit for 5 seconds to start the service if the services are stopped.

Edit, /etc/monit/monitrc And find set daemon. By default, the configuration is 120 seconds. You can set it to 5 seconds.

set daemon 5

And restart monit services.

systemctl restart monit

Voila, now you just automated it!! And you can monitor it on /var/log/monit.log:

[WIB Nov  1 13:24:18] error    : 'cbpolicyd' process is not running
[WIB Nov  1 13:24:18] info     : 'cbpolicyd' trying to restart
[WIB Nov  1 13:24:18] info     : 'cbpolicyd' start: /opt/zimbra/bin/zmcbpolicydctl
[WIB Nov  1 13:24:30] info     : 'cbpolicyd' process is running with pid 4633

Now, if you need cloud services for Zimbra Mail Server, you can contact us on Thanks!

One thought on “Automate Your Stopped Zimbra CBPolicyD Service

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.