Jump to content

Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors


securitybreach

Recommended Posts

securitybreach

Linux and UNIX system services are configured using various text files located in /etc/ or /usr/local/etc/ directory tree. A typical server system could have dozens of configuration files. It is important that you check the validity of the configuration file. In some cases it is possible to to check the sanity of the special data (such as keys) or directories (such as /var/lib/cache/). Text files are easier to manage remotely. You can use ssh and a text editor. If there is an error in configuration, server may not start. This may result into a disaster. In this article I will explains how-to find out a syntax error for popular servers and test configuration file for syntax errors.

 

Stop! Test Your Server Configuration Before Restarting Unix / Linux Services

  • The following option(s) will not run server (or stop running server), it will just test the configuration file and then exit.
     
  • It will check configuration for correct syntax and then try to open files referred in configuration.
     
  • The config file is parsed and checked for syntax errors, along with all files included config file(s) by server.
     
  • In most case you can also specify which configuration file server should useinstead of the default.
     
  • Once you've verified your configuration files and fixed any errors you can go ahead and reload or restart required services.

A Note About Reloading Servers

 

The syntax is as follows under Linux:

/sbin/service SERVICE-NAME [reload|restart]

OR

/etc/init.d/SERVICE-NAME [reload|restart]

OR

systemctl reload SERVICE-NAME-HERE

The reload option reloads the config file without interrupting pending operations. For example the following command will reload Apache web server after the config file changes:

 

# /sbin/service httpd reload

OR

# systemctl reload httpd

However, most Linux and Unix-like daemon programs sometimes use SIGHUP as a signalto restart themselves, the most common reason for this being to re-read a configuration file that has been changed. The syntax is as follows:

 

kill -HUP $(cat /var/run/SERVICE.pid)

OR

kill -HUP `cat /var/run/SERVICE.pid`

Let us see how to test the syntax for various Unix and Linux serveries.,,,,,,,

 

http://www.cyberciti...tax-errors.html

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...