Awesome
await
28K awaitb, small memory footprint, single binary that run list of commands in parallel and waits for their termination
<!-- DO NOT CHANGE THIS FILE IS GENERATED BY ./hooks/pre-commit -->install
# recommended way (crossplatform)
stew i slavaGanzin/await # https://github.com/marwanhawari/stew
# or
eget slavaGanzin/await --to /usr/local/bin/ # https://github.com/zyedidia/eget
# nix
nix-shell -p await
# arch
yay -S await
# not recommended, but it works!
curl https://i.jpillora.com/slavaGanzin/await! | bash
completions
It's a single binary distribution, so you need to do it yourself (or download from a release)
# bash
await --autocomplete-bash >> ~/.bashrc
#zsh
await --autocomplete-zsh >> ~/.zshrc
#fish
await --autocomplete-fish >> ~/.config/fish/completions/await.fish
With await you can:
Take action on specific file type changes
await 'stat **.c' --change --forever --exec 'gcc *.c -o await -lpthread'
# you can filter with:
`stat --format '%n %z' **; | grep -v node_modules`
<img src='demo/7.gif' width='100%'></img>
Wait for FAANG to fail
await 'whois facebook.com' \
'nslookup apple.com' \
'dig +short amazon.com' \
'sleep 1 | telnet netflix.com 443 2>/dev/null' \
'http google.com' --fail
<img src='demo/1.gif' width='100%'></img>
Notify yourself when your site down
await "curl 'https://whatnot.ai' &>/dev/null && echo UP || echo DOWN" \
--forever --change --exec "ntfy send 'whatnot.ai \1'"
<img src='demo/2.gif' width='100%'></img>
Use as concurrently
await "stylus --watch --compress --out /home/vganzin/work/whatnot/front /home/vganzin/work/whatnot/front/index.styl" \
"pug /home/vganzin/work/whatnot/front/index.pug --out /home/vganzin/work/whatnot/front --watch --pretty 2>/dev/null" --forever --stdout --silent
<img src='demo/3.gif' width='100%'></img>
Substitute while substituting
await 'echo -n 10' 'echo -n $RANDOM' 'expr \1 + \2' --exec 'echo \3' --forever --silent
<img src='demo/4.gif' width='100%'></img>
Furiously wait for new iPhone in background process
await 'curl "https://www.apple.com/iphone/" -s | pup ".hero-eyebrow text{}" | grep -v 12' --interval 1000 --change --daemon --exec 'ntfy send "\1"'
<img src='demo/5.gif' width='100%'></img>
Restart database and connect immediately after it become fully functional
sudo systemctl restart redis; await 'socat -u OPEN:/dev/null UNIX-CONNECT:/tmp/redis.sock' --exec 'redis-cli -s /tmp/redis.sock'
<img src='demo/6.gif' width='100%'></img>
--help
await [options] commands[0m
[0m
[33m# runs list of commands and waits for their termination[0m
[0m
[0m
EXAMPLES:[0m
[33m# wait until your deployment is ready[0m
await 'curl 127.0.0.1:3000/healthz' \[0m
'kubectl wait --for=condition=Ready pod it-takes-forever-8545bd6b54-fk5dz' \[0m
"docker inspect --format='{{json .State.Running}}' elasticsearch 2>/dev/null | grep true" [0m
[0m
[33m# action on specific file type changes[0m
await 'stat **.c' --change --forever --exec 'gcc *.c -o await -lpthread'[0m
[0m
[33m# waiting google (or your internet connection) to fail[0m
await 'curl google.com' --fail[0m
[0m
[33m# waiting only google to fail (https://ec.haxx.se/usingcurl/usingcurl-returns)[0m
await 'curl google.com' --status 7[0m
[0m
[33m# waits for redis socket and then connects to[0m
await 'socat -u OPEN:/dev/null UNIX-CONNECT:/tmp/redis.sock' --exec 'redis-cli -s /tmp/redis.sock'[0m
[0m
[33m# lazy version[0m
await 'ls /tmp/redis.sock'; redis-cli -s /tmp/redis.sock[0m
[0m
[33m# daily checking if I am on french reviera. Just in case[0m
await 'curl https://ipapi.co/json 2>/dev/null | jq .city | grep Nice' --interval 86400[0m
[0m
[33m# Yet another server monitor[0m
await "curl 'https://whatnot.ai' &>/dev/null && echo 'UP' || echo 'DOWN'" --forever --change\[0m
--exec "ntfy send \'whatnot.ai \1\'"[0m
[0m
[33m# waiting for new iPhone in daemon mode[0m
await 'curl "https://www.apple.com/iphone/" -s | pup ".hero-eyebrow text{}" | grep -v 12'\[0m
--change --interval 86400 --daemon --exec "ntfy send \1"[0m
[0m
[0m
OPTIONS:[0m
--help [33m#print this help[0m
--stdout -o [33m#print stdout of commands[0m
--no-stderr -E [33m#surpress stderr of commands by adding 2>/dev/null to commands (doesn't work with pipes)[0m
--silent -V [33m#do not print spinners and commands[0m
--fail -f [33m#waiting commands to fail[0m
--status -s [33m#expected status [default: 0][0m
--any -a [33m#terminate if any of command return expected status[0m
--change -c [33m#waiting for stdout to change and ignore status codes[0m
--exec -e [33m#run some shell command on success;[0m
--interval -i [33m#milliseconds between one round of commands [default: 200][0m
--forever -F [33m#do not exit ever[0m
--service -S [33m#create systemd user service with same parameters and activate it[0m
--version -v [33m#print the version of await[0m
--autocomplete-fish [33m#output fish shell autocomplete script[0m
--autocomplete-bash [33m#output bash shell autocomplete script[0m
--autocomplete-zsh [33m#output zsh shell autocomplete script[0m
[0m
[0m
NOTES:[0m
[33m# \1, \2 ... \n - will be subtituted with n-th command stdout[0m
[33m# you can use stdout substitution in --exec and in commands itself:[0m
await 'echo -n 10' 'echo -n $RANDOM' 'expr \1 + \2' --exec 'echo \3' --forever --silent[0m