Skip to content
This repository has been archived by the owner on Oct 15, 2024. It is now read-only.
/ wait-for-command Public archive

Posix sh compliant pure shell script which waits for a specific command exit status. Works in BusyBox.

License

Notifications You must be signed in to change notification settings

ettore26/wait-for-command

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

wait-for-command

wait-for-command is a Posix sh compliant pure shell script which works in BusyBox. Inspired by wait-for-it.sh.

./wait-for-command.sh --help

Usage: wait-for-command.sh [-c 'COMMAND']
       wait-for-command.sh [OPTION]... [-c 'COMMAND']
       wait-for-command.sh [-c 'COMMAND'] [OPTION]...

wait-for-command.sh compares a command exit status to some given number(s) 
for a period of time. If comparison is successfully 
wait-for-command.sh returns 0, otherwise 1.

Example: wait-for-command.sh -c 'echo > /dev/tcp/127.0.0.1/5432'
	  wait-for-command.sh -s 0 57 -c 'curl 127.0.0.1:5432'
	  wait-for-command.sh -c 'nc -z 127.0.0.1 5432' -s 0 -t 20
		 
Options:
  -c, --command ['COMMAND']   execute a COMMAND.
  -s, --status [NUMBER]...    target exit status of COMMAND, default 0.
  -t, --time [NUMBER] 	      max time to wait in seconds, default 10.
  -q, --quiet                 do not make any output, default false.
      --help	              display this help.

Notice that quotes are needed after -c/--command for multi-argument 
COMMANDs.

Specifying a same option more than once overrides the previews. 
So "wait-for-command.sh -c 'nothing' -c 'curl 127.0.0.1:5432'" will be 
the same as "wait-for-command.sh -c 'curl 127.0.0.1:5432'". 
It does not apply to option "-q, --quiet".

About

Posix sh compliant pure shell script which waits for a specific command exit status. Works in BusyBox.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages