How to test an ejabberd.cfg file before restarting the server. Easier than it seems - why not make it a shell alias?
cat ejabberd.cfg | erl | grep syntax
If that command returns a syntax error line, you know there is a problem in the config file. If there is no output, ejabberd.cfg parses correctly.