{"id":13529570,"url":"https://github.com/slavaGanzin/await","last_synced_at":"2025-04-01T16:31:41.543Z","repository":{"id":39585568,"uuid":"324334605","full_name":"slavaGanzin/await","owner":"slavaGanzin","description":"28Kb, small memory footprint, single binary that run list of commands in parallel and waits for their termination","archived":false,"fork":false,"pushed_at":"2024-11-21T15:47:06.000Z","size":6586,"stargazers_count":160,"open_issues_count":2,"forks_count":4,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T08:09:13.018Z","etag":null,"topics":["async","bash","ci","cli","command-line-tool","devops","fish","parallel","posix","runner","util","wait","zsh"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slavaGanzin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-25T09:49:00.000Z","updated_at":"2025-03-24T14:25:14.000Z","dependencies_parsed_at":"2024-04-12T17:41:05.546Z","dependency_job_id":"dfb11e28-a530-4435-936c-5da5615d4007","html_url":"https://github.com/slavaGanzin/await","commit_stats":{"total_commits":219,"total_committers":1,"mean_commits":219.0,"dds":0.0,"last_synced_commit":"d9e62fff84daf5d08dffca2dd4137e6994a91a9a"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavaGanzin%2Fawait","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavaGanzin%2Fawait/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavaGanzin%2Fawait/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavaGanzin%2Fawait/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slavaGanzin","download_url":"https://codeload.github.com/slavaGanzin/await/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246670548,"owners_count":20815003,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","bash","ci","cli","command-line-tool","devops","fish","parallel","posix","runner","util","wait","zsh"],"created_at":"2024-08-01T07:00:37.496Z","updated_at":"2025-04-01T16:31:41.537Z","avatar_url":"https://github.com/slavaGanzin.png","language":"C","funding_links":[],"categories":["Command-Line Productivity","Utilities","Python"],"sub_categories":["Shell Utilities"],"readme":"# await\n 28K\tawait, small memory footprint, single binary that run list of commands in parallel and waits for their termination\n\n\u003c!-- DO NOT CHANGE THIS FILE IS GENERATED BY ./hooks/pre-commit --\u003e\n\n# ![build](https://github.com/slavaGanzin/await/actions/workflows/build-and-release.yml/badge.svg)\n\n\n### install\n```bash\n# recommended way (crossplatform)\nstew i slavaGanzin/await  # https://github.com/marwanhawari/stew\n# or\neget slavaGanzin/await --to /usr/local/bin/  # https://github.com/zyedidia/eget\n\n# nix\nnix-shell -p await\n\n# arch\nyay -S await\n\n# not recommended, but it works!\ncurl https://i.jpillora.com/slavaGanzin/await! | bash\n```\n\n### completions\nIt's a single binary distribution, so you need to do it yourself (or download from a release)\n```bash\n# bash\nawait --autocomplete-bash \u003e\u003e ~/.bashrc\n\n#zsh\nawait --autocomplete-zsh \u003e\u003e ~/.zshrc\n\n#fish\nawait --autocomplete-fish \u003e\u003e ~/.config/fish/completions/await.fish\n```\n\n# With await you can:\n### Take action on specific file type changes\n```bash\nawait 'stat **.c' --change --forever --exec 'gcc *.c -o await -lpthread'\n# you can filter with:\n`stat --format '%n %z' **; | grep -v node_modules`\n```\n\n\u003cimg src='demo/7.gif' width='100%'\u003e\u003c/img\u003e\n\n\n### Wait for FAANG to fail\n```bash\nawait 'whois facebook.com' \\\n      'nslookup apple.com' \\\n      'dig +short amazon.com' \\\n      'sleep 1 | telnet netflix.com 443 2\u003e/dev/null' \\\n      'http google.com' --fail\n```\n\n\u003cimg src='demo/1.gif' width='100%'\u003e\u003c/img\u003e\n\n\n### Notify yourself when your site down\n```bash\nawait \"curl 'https://whatnot.ai' \u0026\u003e/dev/null \u0026\u0026 echo UP || echo DOWN\" \\\n      --forever --change --exec \"ntfy send 'whatnot.ai \\1'\"\n```\n\n\u003cimg src='demo/2.gif' width='100%'\u003e\u003c/img\u003e\n\n\n### Use as [concurrently](https://github.com/kimmobrunfeldt/concurrently)\n```bash\nawait \"stylus --watch --compress --out /home/vganzin/work/whatnot/front /home/vganzin/work/whatnot/front/index.styl\" \\\n      \"pug /home/vganzin/work/whatnot/front/index.pug --out /home/vganzin/work/whatnot/front --watch --pretty 2\u003e/dev/null\" --forever --stdout --silent\n```\n\n\u003cimg src='demo/3.gif' width='100%'\u003e\u003c/img\u003e\n\n\n### [Substitute while substituting](https://memegenerator.net/img/instances/48173775.jpg)\n```bash\nawait 'echo -n 10' 'echo -n $RANDOM' 'expr \\1 + \\2' --exec 'echo \\3' --forever --silent\n```\n\n\u003cimg src='demo/4.gif' width='100%'\u003e\u003c/img\u003e\n\n### Furiously wait for new iPhone in background process\n```bash\nawait 'curl \"https://www.apple.com/iphone/\" -s | pup \".hero-eyebrow text{}\" | grep -v 12' --interval 1000 --change --daemon --exec 'ntfy send \"\\1\"'\n```\n\n\u003cimg src='demo/5.gif' width='100%'\u003e\u003c/img\u003e\n\n### Restart database and connect immediately after it become fully functional\n```bash\nsudo systemctl restart redis; await 'socat -u OPEN:/dev/null UNIX-CONNECT:/tmp/redis.sock' --exec 'redis-cli -s /tmp/redis.sock'\n```\n\n\u003cimg src='demo/6.gif' width='100%'\u003e\u003c/img\u003e\n\n\n## --help\n```bash\nawait [options] commands\n\n# runs list of commands and waits for their termination\n\n\nEXAMPLES:\n# wait until your deployment is ready\n  await 'curl 127.0.0.1:3000/healthz' \\\n\t'kubectl wait --for=condition=Ready pod it-takes-forever-8545bd6b54-fk5dz' \\\n\t\"docker inspect --format='{{json .State.Running}}' elasticsearch 2\u003e/dev/null | grep true\" \n\n# emulate watch https://linux.die.net/man/1/watch\n  await 'clear; du -h /tmp/file' 'dd if=/dev/random of=/tmp/file bs=1M count=1000 2\u003e/dev/null' -of --silent\n\n# action on specific file type changes\n  await 'stat **.c' --change --forever --exec 'gcc *.c -o await -lpthread'\n\n# waiting google (or your internet connection) to fail\n  await 'curl google.com' --fail\n\n# waiting only google to fail (https://ec.haxx.se/usingcurl/usingcurl-returns)\n  await 'curl google.com' --status 7\n\n# waits for redis socket and then connects to\n  await 'socat -u OPEN:/dev/null UNIX-CONNECT:/tmp/redis.sock' --exec 'redis-cli -s /tmp/redis.sock'\n\n# lazy version\n  await 'ls /tmp/redis.sock'; redis-cli -s /tmp/redis.sock\n\n# daily checking if I am on french reviera. Just in case\n  await 'curl https://ipapi.co/json 2\u003e/dev/null | jq .city | grep Nice' --interval 86400\n\n# Yet another server monitor\n  await \"curl 'https://whatnot.ai' \u0026\u003e/dev/null \u0026\u0026 echo 'UP' || echo 'DOWN'\" --forever --change\\\n    --exec \"ntfy send \\'whatnot.ai \\1\\'\"\n\n# waiting for new iPhone in daemon mode\n  await 'curl \"https://www.apple.com/iphone/\" -s | pup \".hero-eyebrow text{}\" | grep -v 12'\\\n --change --interval 86400 --daemon --exec \"ntfy send \\1\"\n\n\nOPTIONS:\n  --help\t\t#print this help\n  --stdout -o\t\t#print stdout of commands\n  --no-stderr -E\t#surpress stderr of commands by adding 2\u003e/dev/null to commands (doesn't work with pipes)\n  --silent -V\t\t#do not print spinners and commands\n  --fail -f\t\t#waiting commands to fail\n  --status -s\t\t#expected status [default: 0]\n  --any -a\t\t#terminate if any of command return expected status\n  --change -c\t\t#waiting for stdout to change and ignore status codes\n  --exec -e\t\t#run some shell command on success;\n  --interval -i\t\t#milliseconds between one round of commands [default: 200]\n  --forever -F\t\t#do not exit ever\n  --service -S\t\t#create systemd user service with same parameters and activate it\n  --version -v\t\t#print the version of await\n  --autocomplete-fish\t#output fish shell autocomplete script\n  --autocomplete-bash\t#output bash shell autocomplete script\n  --autocomplete-zsh\t#output zsh shell autocomplete script\n\n\nNOTES:\n# \\1, \\2 ... \\n - will be subtituted with n-th command stdout\n# you can use stdout substitution in --exec and in commands itself:\n  await 'echo -n 10' 'echo -n $RANDOM' 'expr \\1 + \\2' --exec 'echo \\3' --forever --silent\n\u003c!-- DO NOT CHANGE THIS FILE IS GENERATED BY ./hooks/pre-commit --\u003e\n\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FslavaGanzin%2Fawait","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FslavaGanzin%2Fawait","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FslavaGanzin%2Fawait/lists"}