Guest User

Untitled

a guest
Jul 17th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. $ sudo nginx -t
  2. nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
  3. nginx: configuration file /etc/nginx/nginx.conf test is successful
  4.  
  5. [root@d ~]# /usr/local/nginx/sbin/nginx -t;echo $?
  6. nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
  7. nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
  8. 0
  9. [root@d ~]# echo whatever > /usr/local/nginx/nonsense.conf
  10. [root@d ~]# /usr/local/nginx/sbin/nginx -t -c nonsense.conf;echo $?
  11. nginx: [emerg] unexpected end of file, expecting ";" or "}" in /usr/local/nginx/nonsense.conf:2
  12. nginx: configuration file /usr/local/nginx/nonsense.conf test failed
  13. 1
  14.  
  15. #!/bin/bash
  16. /usr/local/nginx/sbin/nginx -t 2>/dev/null > /dev/null
  17. if [[ $? == 0 ]]; then
  18. echo "success"
  19. # do things on success
  20. else
  21. echo "fail"
  22. # do whatever on fail
  23. fi
Add Comment
Please, Sign In to add comment