Skip to content

Instantly share code, notes, and snippets.

@haproxytechblog
Last active August 24, 2021 12:55
Show Gist options
  • Save haproxytechblog/3be3351f1cead3fc919c6edbe7f77430 to your computer and use it in GitHub Desktop.
Save haproxytechblog/3be3351f1cead3fc919c6edbe7f77430 to your computer and use it in GitHub Desktop.
$ haproxy -f /path/to/haproxy.cfg -c
defaults
mode http
timeout client 10000ms
timeout connect 3000ms
timeout server 10000ms
frontend fe_test
bind *:8080
default_backend be_test
backend be_test
server my_server 127.0.0.1:8000 chekc
$ haproxy -f /tmp/test.cfg -c
Configuration file is valid
$ ps
PID TTY TIME CMD
3219 pts/4 00:00:00 bash
20940 pts/4 00:00:00 ps
$ haproxy -f /tmp/test.cfg -c
[NOTICE] (14686) : haproxy version is 2.4.2-1ppa1~focal
[NOTICE] (14686) : path to executable is /usr/sbin/haproxy
[ALERT] (14686) : parsing [/tmp/test.cfg:12] : 'server server1' : unknown keyword 'chekc'; did you mean 'check' maybe ?.
[ALERT] (14686) : Error(s) found in configuration file : /tmp/test.cfg
[ALERT] (14686) : Fatal errors found in configuration.
$ haproxy -f /etc/haproxy/haproxy.cfg -c
Configuration file is valid
#!/usr/bin/bash
haproxy -f /path/to/haproxy.cfg -c
if [ $? -eq 0 ]; then
echo OK
else
echo FAIL
fi
FAIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment