Website of latouche

[home] [Computers and networks] [tips]

Configuration files testing before restarting/reloading a service


Restarting a service after a configuration file have been modified can be risky (a ssh server that doesn't listen anymore to the only accessible IP for exemple). Some services propose ways to check if the configuration is corect before being restarted. Somes even check by themself when they are reloaded so prefer, when possible, reloading a service rather than restarting it.


SSH is probably the most important service, specially for all the computers that can't be accessed physically.

There is now way to reload the configuration, so you must restart it every time you need to modify it, but your active connections are not broken during the restart. It's then possible to test the new configuration and if it's not OK to retore the old one. You just have to expect that there will be no timeout due to network failure or that not reboot will occure ...

sshd provides a way to test it's configuration file with the -t option which will test the configuration and the keys (sshd should always be called with the full path):

/usr/sbin/sshd -t

On Debian, this test is performed by the init script during reloading or restarting actions. Whilst for Gentoo, it occures for start and stop actions.


The option -t of the dhcpd server of ISC provides a way to test the configuration:

dhcpd3 -t -cf /etc/dhcp3/dhcpd.conf


Openldap provides a tool to test slapd.conf : slapdtest.

2008/01/24 - First release
2008/05/16 - Added note for ssh checks on Debian and Gentoo init script
Last update: 2008/05/16