Ken's Lotto Syndicate

Powerball Syndicate Home Page

Site Tools


add_a_timeout

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
add_a_timeout [2025/06/02 22:40] – created kenadd_a_timeout [2026/07/07 23:13] (current) – external edit 127.0.0.1
Line 7: Line 7:
 <code> <code>
 until curl --silent --fail-with-body 10.0.0.1:8080/health; do until curl --silent --fail-with-body 10.0.0.1:8080/health; do
- sleep 1+  sleep 1
 done done
 </code> </code>
Line 13: Line 13:
 This works fine. Unless our web server crashes during startup and we sleep 1 forever.\\ This works fine. Unless our web server crashes during startup and we sleep 1 forever.\\
 \\ \\
-Here comes a handy utility: timeout. As the name suggests, this command adds a timeout to other commands.\\+Here comes a handy utility: timeout. \\ 
 +As the name suggests, this command adds a timeout to other commands.\\
 You specify the time limit you want to wait for a command and if that time passes, timeout sends a signal to terminate it and exits with non-zero.\\ You specify the time limit you want to wait for a command and if that time passes, timeout sends a signal to terminate it and exits with non-zero.\\
 By default, timeout sends SIGTERM, but you can change it with the --signal flag, e.g. ''timeout --signal=SIGKILL 1s foo''.\\ By default, timeout sends SIGTERM, but you can change it with the --signal flag, e.g. ''timeout --signal=SIGKILL 1s foo''.\\
Line 32: Line 33:
 <code> <code>
 timeout 1m until curl --silent --fail-with-body 10.0.0.1:8080/health; do timeout 1m until curl --silent --fail-with-body 10.0.0.1:8080/health; do
- sleep 1+  sleep 1
 done done
 </code> </code>
Line 41: Line 42:
 <code> <code>
 timeout 1m bash -c "until curl --silent --fail-with-body 10.0.0.1:8080/health; do timeout 1m bash -c "until curl --silent --fail-with-body 10.0.0.1:8080/health; do
- sleep 1+  sleep 1
 done" done"
 </code> </code>
add_a_timeout.1748904028.txt.gz · Last modified: (external edit)