Thursday, August 12, 2010

Server configuration file syntax Checking commands


I have planned to write this post some long time ago, now the time has come to do it.

Basically configuring servers in Linux/*nix include editing of configuration files and saving them. Once editing the files if any syntax error is there and when we start the service they will show some wearied errors which we cant resolve.
For counter attacking this type of issues for each service there will be one command to check this syntax errors before starting of the service/server, I have collected these commands from my experience and from some of my friends. Please feel free to comment on this if you know some other commands so that I will update my post.

SSHD server check for syntax error
=========================
sshd -t
FTP server check for syntax error
=========================
#vsftpd
DNS server check for syntax error
==========================

For checking syntax errors in main configuration file..
#named-checkconf main-config-file

Example:
#named-checkconf named.conf
Syntax OK

#named-checkzone domain zonefile-loc
Example:
#named-checkzone example.com /var/named/chroot/var/named/exaple-zone.frd

SAMBA server check for syntax error
=============================
#testparm

APACHE server check for syntax error

=============================
httpd -t
For virtual hosts
httpd -t -D DUMP_VHOSTS
TCP Wrappers check for syntax error
============================
tcpdchk
tcpdchk -v

Postfox server check for syntax error
============================
postfix checkpostfix -vv
LIGHTTPD 
server check for syntax error
=============================
lighttpd -t -f /etc/lighttpd/lighttpd.conf

Squid 
server check for syntax error
==========================
squid -k check
squid -k parse


NAGIOS server check for syntax error
====================================
/usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg