Skip to main content
added 633 characters in body
Source Link
hschou
  • 3k
  • 14
  • 16

If possible check if Jboss is listening on the port:

if curl -Is http://localhost:80/ > /dev/null then echo OK else echo FAIL fi 

You just need one external program: curl

Edit:

Another approach is to test for a specific content, say Contact on the web page. Only if the webserver is running and there is a connection to the database, it will respond correctly.

if grep -qc "Contact" <(curl -s http://localhost/) then echo OK else echo FAIL fi 

The construction <(curl ...) (Process Substitution) will be seen by grep as a file. curl has option -s for silent to avoid transfer progress. grep has option -qc to suppress output and count the occurrence of the matched text. If one or more count of Contact the result is OK (exit code 0).

If possible check if Jboss is listening on the port:

if curl -Is http://localhost:80/ > /dev/null then echo OK else echo FAIL fi 

You just need one external program: curl

If possible check if Jboss is listening on the port:

if curl -Is http://localhost:80/ > /dev/null then echo OK else echo FAIL fi 

You just need one external program: curl

Edit:

Another approach is to test for a specific content, say Contact on the web page. Only if the webserver is running and there is a connection to the database, it will respond correctly.

if grep -qc "Contact" <(curl -s http://localhost/) then echo OK else echo FAIL fi 

The construction <(curl ...) (Process Substitution) will be seen by grep as a file. curl has option -s for silent to avoid transfer progress. grep has option -qc to suppress output and count the occurrence of the matched text. If one or more count of Contact the result is OK (exit code 0).

Source Link
hschou
  • 3k
  • 14
  • 16

If possible check if Jboss is listening on the port:

if curl -Is http://localhost:80/ > /dev/null then echo OK else echo FAIL fi 

You just need one external program: curl