Hands-on task
Exit code: a health-check script
The service manager checks the app with a script and looks only at its exit code: 0 means all is well, anything else means something is wrong. Write /root/healthcheck.sh:
- if the file
/root/app/readyexists, it printshealthyand exits with code 0; - if there's no such file, it prints
unhealthyand exits with code 1.
Right now the file doesn't exist. Check both cases: run the script and look at the exit code, then create the file and run it again.
- bash scripts
- exit code
- exit
- $?