![]() The same command used for the MariaDB database server also works for checking the Mariadb database server configuration file syntax: # mysqld -validate-config After running the command, if there are no errors, the server terminates with an exit code of 0, otherwise, it displays a diagnostic message and terminates with an exit code of 1: # mysqld -validate-config Use the following command to test the MySQL database server configuration file syntax. Run the dhcpd command with the -t flag to check the configuration syntax of the dhcpd server: # dhcpd -t Run the following command to test the configuration file for the vsftpd FTP server: # vsftpd # caddy validate -config /path/to/config/file The first one checks the default configuration, alternatively, use the -config command line option to specify a configuration file: # caddy validate To expose any errors in the Caddy web server configuration, issue the following command. ![]() The -k option together with the parse or debug subcommands, tell the squid daemon to parse the configuration file or enable debugging mode respectively: # squid -k parse ![]() To pass the squid configuration file for the Squid proxy caching server, issue the following command. # varnishd -f /etc/varnish/default.vcl -C If all is OK, the varnish will dump out the generated configuration, otherwise, it will display a specific line number in the file which has an error: # varnishd -C To check the varnishd VCL ( Varnish Configuration Language) file syntax for any errors, use the following command. You can specify a different configuration file using the -f command line option: # pound -c Run the pound command with the -c flag without any other argument to check the default configuration file. You can parse the Pound server configuration file before starting the server. # $TOMCAT_HOME/bin/catalina.sh configtest First, move into your tomcat installation directory and issue the following command: #. Tomcat web server allows for basic configuration syntax check. Use the -f flag to specify a custom configuration file: # lighttpd -t The -t command line option enables Lighttpd to test the default configuration file for syntax errors and exit. Run the following command to test Lighttpd’s configuration file syntax. HAProxy’s configuration can be tested using the following command where the -f option specifies the file and -c enables test mode: # haproxy -f /etc/haproxy/haproxy.cfg -cĬheck HAProxy Configuration 10. You can then check the Apache web server configuration file using the following command: # apachectl configtestĪlternatively, you can use the following commands on RedHat-based distributions: # httpd -t Note that calling the -t flag twice (-tt) causes the configuration to be dumped before exiting: # php-fpm -t To check the php-fpm configuration file, run the following command. To specify a different configuration file, use the -c flag: # nginx -t To check the NGINX configuration file, run the nginx command with the -t flag. To check a particular configuration file, specify it using the -f flag: # sshd -t To check the validity of the sshd configuration file and the sanity of the keys, issue the following command. It loads unit files and prints warnings if any errors are detected.īy default, it loads files specified on the command line as an argument, and any other units referenced by them: # systemd-analyze verify /etc/systemd/system/rviceĬheck Systemd Unit Files Configuration 5. The “ systemd-analyze verify” command allows for testing the systemd unit file for syntax errors. To check Perl scripts for syntax errors, use the following command: # perl -c /path/to/scriptname You can check Bash scripts for syntax errors as follows: # bash -n /path/to/scriptname.shĬheck Bash Script Syntax Errors 3. The -f option displays the error message and opens the file for editing: # visudo -c /etc/sudoersĬheck Suders Configuration 2. ![]() You can check the sudo configuration file syntax using the visudo command, which supports a -check or -c command line option to only validate a file without an edit. Note: Use if you are not logged on a server as the root user, remember to use the sudo command where necessary while invoking a command because some services run with root privileges, and checking their configuration files requires root user permissions. We have put together a list of common applications and services on Linux systems and how to test or validate their configuration files. Several applications/programs or service daemons ship with commands to check configuration files for syntax correctness. This helps to reduce the chances of the service failing to restart due to configuration errors. Configuration syntax checking and/or testing is a key step to perform after making changes to an application’s or service’s configuration file or even after running updates.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |