### Quick Start execution Source: https://github.com/3axap4ehko/watchctl/blob/master/README.md Example of waiting for a database port before launching an application with retry logic. ```bash watchctl \ --wait-tcp db:5432 \ --retry-times 3 \ -- ./my-app ``` -------------------------------- ### Install watchctl from source Source: https://github.com/3axap4ehko/watchctl/blob/master/README.md Use cargo to install the tool directly from the local source directory. ```bash cargo install --path . ``` -------------------------------- ### Wait for PostgreSQL before starting app Source: https://github.com/3axap4ehko/watchctl/blob/master/README.md Use this command to delay application startup until a TCP port becomes available. ```bash watchctl --wait-tcp localhost:5432 --wait-timeout 60s -- ./my-app ``` -------------------------------- ### Docker entrypoint configuration Source: https://github.com/3axap4ehko/watchctl/blob/master/README.md Integrate watchctl into a Dockerfile to manage service dependencies at startup. ```dockerfile ENTRYPOINT ["watchctl", "--wait-tcp", "db:5432", "--"] CMD ["./app"] ``` -------------------------------- ### General usage syntax Source: https://github.com/3axap4ehko/watchctl/blob/master/README.md The basic command structure for invoking watchctl. ```bash watchctl [OPTIONS] -- [ARGS...] ``` -------------------------------- ### Wait phase configurations Source: https://github.com/3axap4ehko/watchctl/blob/master/README.md Commands to block execution until specific dependencies like TCP ports, HTTP endpoints, or files are available. ```bash # Wait for TCP port watchctl --wait-tcp localhost:5432 -- ./my-app # Wait for HTTP endpoint watchctl --wait-http http://localhost:8080/health -- ./my-app # Wait for file watchctl --wait-file /var/run/ready -- ./my-app # Wait with delay watchctl --wait-delay 5s -- ./my-app # Combine conditions (all must pass) watchctl --wait-tcp localhost:5432 --wait-http http://localhost:8080/health -- ./my-app ``` -------------------------------- ### Supervised service with health checks Source: https://github.com/3axap4ehko/watchctl/blob/master/README.md Configure a service with TCP wait conditions, HTTP health checks, and retry logic. ```bash watchctl \ --wait-tcp localhost:5432 \ --watch-http http://localhost:8080/health \ --watch-delay 5s \ --watch-http-interval 30s \ --retry-times 5 \ --retry-delay 5s \ --retry-backoff \ --log /var/log/watchctl.log \ -- ./my-service ``` -------------------------------- ### Logging configuration Source: https://github.com/3axap4ehko/watchctl/blob/master/README.md Commands to enable logging to a file and control verbosity via environment variables. ```bash watchctl --log /var/log/watchctl.log --wait-tcp localhost:5432 -- ./my-app ``` ```bash RUST_LOG=debug watchctl --log /var/log/watchctl.log -- ./my-app ``` -------------------------------- ### Watch phase configurations Source: https://github.com/3axap4ehko/watchctl/blob/master/README.md Commands to monitor process health during execution and terminate if checks fail. ```bash # Watch HTTP endpoint watchctl --watch-http http://localhost:8080/health --watch-http-interval 30s -- ./my-app # Wait 5s before the first watch probe watchctl --watch-http http://localhost:8080/health --watch-delay 5s -- ./my-app # Watch TCP port watchctl --watch-tcp localhost:8080 -- ./my-app # Watch file existence watchctl --watch-file /var/run/healthy -- ./my-app # Set maximum runtime watchctl --watch-timeout 1h -- ./my-app ``` -------------------------------- ### Retry phase configurations Source: https://github.com/3axap4ehko/watchctl/blob/master/README.md Commands to handle automatic restarts based on exit codes, delays, or backoff strategies. ```bash # Retry up to 3 times watchctl --retry-times 3 -- ./my-app # Retry with delay watchctl --retry-times 3 --retry-delay 5s -- ./my-app # Retry with exponential backoff watchctl --retry-times 5 --retry-delay 1s --retry-backoff -- ./my-app # Retry only on specific exit codes watchctl --retry-times 3 --retry-if 1,2,3 -- ./my-app # Retry on any failure except permanent errors watchctl --retry-times 3 --retry-except 78,77 -- ./my-app # Combine: restart on every exit, including success, except a clean shutdown code watchctl --retry-times 0 --retry-if 0 --retry-except 42 -- ./my-app # Re-run wait phase before each retry watchctl --retry-times 3 --retry-with-wait --wait-tcp localhost:5432 -- ./my-app ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.