Before handing over the shift, the on-call admin runs ~/health-lab/healthcheck.sh: the script asks the app on port 8080 and prints OK or FAIL. Today it printed OK, while users write that the site does not open. Look at the script, run it, and ask the app yourself.
Run the shift check
In ~/health-lab, look at the healthcheck.sh script, run it, then ask the app yourself with curl.
First, predict
What will ./healthcheck.sh print on its last line?
Now start the exercise, run the command and compare your prediction with the output.
The app does not answer, yet healthcheck.sh printed OK. What did the if [ $? -eq 0 ] line check?
-
curl could not connect. Had the check been on curl, the script would have printed FAIL.
-
The script never sees the answer:
-o /dev/nullthrows away whatever curl received.
The condition got the result of echo, which ran without an error.