How to check if dovecot's configuration is valid? (config file syntax)
Is there a command that I can issue that will tell me if the current set of config files for dovecot are valid or if there's an issue?
I just made a change to my dovecot config files. Before attempting to restart the service, I just want to do a quick sanity check to confirm if I made a fat-finger mistake or not.
I'm looking for the dovecot equivalent of any of the following:
nginx -t
apachectl -t
postfix check
Please let me know if there is some way to check the validity of my dovecot configuration.
Solution 1:
Use doveconf
.
The below doveconf
command will exit non-zero and output a message if there's an issue with your dovecot config
doveconf 1>/dev/null
echo $?
The above command will output only STDERR and the print the exit status of doveconf
.
For example, the following output confirms that the dovecot config is OK.
root@host:~# doveconf 1>/dev/null
root@host:~# echo $?
0
root@host:~#