Wait for another service to become available
Example usage · Submit a PR
./wait-for
is a script designed to synchronize services like docker containers. It is sh and alpine compatible. It was inspired by vishnubob/wait-for-it, but the core has been rewritten at Eficode by dsuni and mrako.
When using this tool, you only need to pick the wait-for
file as part of your project.
Download the wait-for
file, either the latest from master
or for a specific version check out the Releases-page.
With the file locally on your file system, you can directly invoke it.
./wait-for host:port|url [-t timeout] [-- command args]
-q | --quiet Do not output any status messages
-t TIMEOUT | --timeout=timeout Timeout in seconds, zero for no timeout
-- COMMAND ARGS Execute command with args after the test finishes
Alternatively, you could download the script and pipe it into sh
:
$ wget -qO- https://raw.githubusercontent.com/eficode/wait-for/v2.1.3/wait-for | sh -s -- google.com:80 -- echo success
Note: When using the latter option, make sure to pin the version by commit hash. Future releases could introduce non-backwards compatible changes and leaves you vulnerable to malicious users modifying this script in the future (as has e.g. happened with Codecov).
To check if www.eficode.com is available:
$ ./wait-for www.eficode.com:80 -- echo "Eficode site is up"
Eficode site is up
To wait for database container to become available:
version: '3'
services:
db:
image: postgres:9.4
backend:
build: backend
command: sh -c './wait-for db:5432 -- npm start'
depends_on:
- db
To check if https://www.eficode.com is available over HTTPS:
$ ./wait-for https://www.eficode.com -- echo "Eficode is accessible over HTTPS"
Eficode is accessible over HTTPS
To wait for your API service to become available:
version: '3'
services:
api:
image: nginx
tests:
build: .
command: sh -c './wait-for http://api -- echo "The api is up! Let's use it"'
depends_on:
- api
Ironically testing is done using bats, which on the other hand is depending on bash.
docker build -t wait-for .
docker run --rm -t wait-for
When creating PRs, please style your commit messages according to conventional commit, you can use a tool like commitizen to guide you. We will automatically infer the changelog from your commits. Alternatively, we can squash all commits when merging and update the commit message.
This project strongly prefers maintaining backwards compatibility, therefore some obvious "fixes" might not be accepted.
Also, please include or update the test cases whenever possible by extending wait-for.bats
.
Make sure netcat is installed in your Dockerfile before running the command if you test over plain TCP.
RUN apt-get -q update && apt-get -qy install netcat
https://stackoverflow.com/questions/44663180/docker-why-does-wait-for-always-time-out
If you are connecting over HTTP, then you will need to have wget available.
#include <iostream> // std::cout #include <thread> // std::thread #include <chrono> // std::chrono::seconds #include <mutex> // std::mutex, std::unique_l
一、关于std::future成员函数wait_for(): 1.1 关于std::future_status: std::future_status是一个枚举类型,其值有三: // ENUM future_status enum class future_status { // names for timed wait function returns ready, timeou
wait_for 模块 wait_for模块在继续执行之前等待一个条件成立. 一、摘要 常用场景: 当服务的初始化脚本返回后不能立即可用时,等待可用状态是很有用的。 当使用community.libvirt.virt模块启动来宾程序并需要暂停直到它们准备好时,它也很有用。 这个模块也可以用在等待匹配字符串出现在文件中后,再继续执行。 这个模块也可以用来等待文件在文件系统上可用或不存在时,再继续执行
模块说明 当你利用service 启动tomcat,或数据库后,他们真的启来了么?这个你是否想确认下? wait_for模块就是干这个的。等待一个事情发生,然后继续。它可以等待某个端口被占用,然后再做下面的事情,也可以在一定时间超时后做另外的事。 常用参数 参数名 是否必须 默认值 选项 说明 connect_timeout no 5 在下一个事情发生前等待链接的时间,单位是秒 delay no
说明 本文介绍了 tomcat 依赖于 mysql 的启动的一个例子 使用 docker-compose + wait-for-it.sh 基础知识 Dockerfile CMD 命令的作用 先看个例子: === Dockerfile ============== FROM ubuntu:16.04 CMD ["echo", "hello my ubuntu"] =================
adb shell 大全: http://adbshell.com/commands 下列表格列出了adb常见命令,注意,它并不是只有adb shell,shell只是其中一个. Category Command Description Comments Options -d 仅仅通过USB接口来管理abd 如果不只是用USB接口来管理则返回错误 -e 仅仅通过模拟器实例来管理adb 如果不是
1. 把脚本复制到镜像内 Dockerfile中 COPY wait-for-it.sh /usr/local/bin/ 2.在docker-compose.yml中修改添加 entrypoint: “bash /usr/local/bin/wait-for-it.sh mysql:3306 – java -jar /safebox-eureka.jar” 示例: *version: ‘2.4’
之前使用4.13版本的内核可以正常启动,但是换成5.2版本的内核后就提示上述错误,最开始认为是spi驱动加载不正确,但是对比之前的内核配置和设备树,没有发现问题. 最后发现4.13版本的内核里面关于spi-nor flash,默认的设备号是1<<15 - 1,即32766,所以启动参数里面写的是mtdparts=spi32766.0,但是升级到5.2版本的内核后,spi-nor flash 的默认
真机调试adb:wait for device 解决方案 参考文章: (1)真机调试adb:wait for device 解决方案 (2)https://www.cnblogs.com/yanzisucheng/p/4369266.html 备忘一下。
ERROR: for ruoyi-mysql Cannot start service ruoyi-mysql: driver failed programming external connectivity on endpoint ruoyi-mysql (f8adc2ba3b5617c4fd863ddb6961f2815e489090c8b12089b1d6466e05d79163): (
root@ubuntu:/home/ubuntu/k8s# kubeadm init --config kubeconfig.yml --v=5 I0623 15:19:11.938930 37878 initconfiguration.go:200] loading configuration from “kubeconfig.yml” W0623 15:19:11.944626 37878 c
今天tomcat的docker容器挂了,只要是带命令-p映射端口就起不来并且报错: Error response from daemon: Cannot start container eb9d501f56bc142d9bf75ddfc7ad88383b7388ca6a5959309af2165f1fff6292: iptables failed: iptables --wait -t nat -
今天tomcat的docker容器挂了,只要是带命令-p映射端口就起不来并且报错: Error response from daemon: Cannot start container eb9d501f56bc142d9bf75ddfc7ad88383b7388ca6a5959309af2165f1fff6292: iptables failed: iptables --wait -t nat -
描述 (Description) 此函数等待子进程终止,返回已故进程的进程ID。 该流程的退出状态包含在$?中。 语法 (Syntax) 以下是此函数的简单语法 - wait 返回值 (Return Value) 如果没有子进程,则此函数返回-1,否则返回已故进程的进程ID<!-- 例子 (Example) Following is the example code showing its ba
wait(等待子进程中断或结束) 相关函数 waitpid,fork 表头文件 #include<sys/types.h> #include<sys/wait.h> 定义函数 pid_t wait (int * status); 函数说明 wait()会暂时停止目前进程的执行,直到有信号来到或子进程结束。如果在调用wait()时子进程已经结束,则wait()会立即返回子进程结束状态值。子进程的结束
wait 等待子进程中断或结束 相关函数 waitpid,fork 表头文件 #include<sys/types.h> #include<sys/wait.h> 定义函数 pid_t wait(int *status); 函数说明 wait()会暂时停止目前进程的执行,直到有信号来到或子进程结束。如果在调用wait()时子进程已经结束,则wait()会立即返回子进程结束状态值。子进程的结束状
wait-for-it.sh 等待某给定服务的端口可用(服务启动起来),否则不断探测。
wait 用法 Usage: docker wait [OPTIONS] CONTAINER [CONTAINER...] Block until a container stops, then print its exit code. --help=false Print usage 说明 阻塞对指定容器的其他调用方法,直到容器停止后退出阻塞。
Pg-wait-sampling 是等待事件的抽样统计。 介绍 PostgreSQL 9.6+提供了有关特定进程当前等待事件的信息。然而,为了收集服务器行为的描述性统计,用户必须多次采样当前等待事件。Pg-wait-sampling 是用于收集等待事件的采样统计信息的扩展。 它收集两种统计。 等待事件的历史记录。它被实现为内存中环形缓冲区,其中每个进程的样本等待事件用给定(可配置)周期写入。因此,