waitfor
Wait for conditions in automation scripts. Check for ports, files, URLs, or processes before continuing.
Installation
pip install waitfor-cli
Usage
Wait for a port to be open
# Wait for port 8080 on localhost
waitfor port 8080
# Wait for port on remote host
waitfor port 5432 -h db.example.com
# Wait for port to be CLOSED
waitfor port 8080 --closed
Wait for a file
# Wait for file to exist
waitfor file /tmp/ready.flag
# Wait for file to be gone
waitfor file /var/run/app.pid --gone
# Wait for file to contain specific content
waitfor file /var/log/app.log --contains "Server started"
Wait for a URL to respond
# Wait for health endpoint
waitfor url http://localhost:3000/health
# Wait for specific status code
waitfor url http://api.example.com/status --status 200
# Wait for response to contain string
waitfor url http://localhost:8080/ready --contains "ok"
Wait for a process
# Wait for process to start
waitfor process nginx
# Wait for process to stop
waitfor process nginx --gone
Wait for a command to succeed
# Wait for docker container to be healthy
waitfor command "docker inspect --format='{{.State.Health.Status}}' myapp | grep healthy"
# Wait for database to accept connections
waitfor command "pg_isready -h localhost"
Wait for remote TCP connection
# Wait for database to be reachable
waitfor tcp db.example.com 5432
# Wait for Redis
waitfor tcp localhost 6379
Options
All commands support these common options:
| Option | Description | Default |
|---|---|---|
-t, --timeout |
Timeout in seconds (0 = forever) | 30 |
-i, --interval |
Check interval in seconds | 1.0-2.0 |
-q, --quiet |
Suppress output | off |
--json |
JSON output | off |
Exit Codes
0- Condition met1- Timeout or condition not met
JSON Output
$ waitfor port 8080 --json
{"success": true, "condition": "port 8080 on localhost to be open", "elapsed_seconds": 0.01, "attempts": 1}
Examples
Wait for services before running tests
#!/bin/bash
waitfor port 5432 -t 60 && \
waitfor port 6379 -t 30 && \
waitfor url http://localhost:8080/health -t 60 && \
pytest
Deployment script
#!/bin/bash
docker-compose up -d
# Wait for all services
waitfor port 80 -t 120
waitfor url http://localhost/api/health --contains "healthy" -t 60
echo "Deployment complete!"
Wait for build artifact
# Start build in background
make build &
# Wait for output
waitfor file ./dist/app.js -t 300
For AI Agents
See SKILL.md for agent-optimized documentation.
License
MIT
Release files for waitfor-cli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| waitfor_cli-0.1.0.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| waitfor_cli-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.3 kB
Release files / waitfor_cli-0.1.0.tar.gz
| Download URL | waitfor_cli-0.1.0.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
65150e961e6333b4dd1b2f369aed0d914642a9bc2aa01690ffdbab6e34773016
|
|
BLAKE2b-256 checksum How to use checksums |
cf7fcc211e6c7803fc3243ca0cc5099f7f4bf19435a5c02579c6a8d3a2d5106c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / waitfor_cli-0.1.0-py3-none-any.whl
| Download URL | waitfor_cli-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
53e6ae3c6c5ce767bdb6804fc60b291c4951d024c7f22b1976ce3cdce82d1dff
|
|
BLAKE2b-256 checksum How to use checksums |
3b2eca6b32d673671091bb9981b7f2e8efdbae983c2186c8d73bbe3cd9d2596c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|