$RodHat_/search
exit code reference

Exit 124

timeout(1) killed the command because the time limit expired.

Value
124
Convention
Shell and tool convention

GNU coreutils timeout exits 124 when it had to stop the command and --preserve-status is not set. A script that treats every non-zero status alike will log this as a failure and retry; a script that needs a deadline should handle 124 on purpose. Add -k so a child that ignores SIGTERM still dies, and expect 137 when that second kill fires.

What to check

timeout -k 5 30 ./job; rc=$?; [ "$rc" -eq 124 ] && echo timed out

Rod on this

Sources

  1. Exit Status, GNU Bash manual
  2. timeout invocation, GNU coreutils manual

Exit codes are conventions, not guarantees: a program can return any value from 0 to 255. Spot one that's wrong? Tell Rod.