@@ -101,61 +101,67 @@ sudo systemctl restart redis; await 'socat -u OPEN:/dev/null UNIX-CONNECT:/tmp/r
101
101
102
102
## --help
103
103
``` bash
104
- await [arguments] commands
105
-
106
- # runs list of commands and waits for their termination
107
-
108
- OPTIONS:
109
- --help # print this help
110
- --stdout -o # print stdout of commands
111
- --no-stderr -E # surpress stderr of commands by adding 2>/dev/null to commands
112
- --silent -V # do not print spinners and commands
113
- --fail -f # waiting commands to fail
114
- --status -s # expected status [default: 0]
115
- --any -a # terminate if any of command return expected status
116
- --change -c # waiting for stdout to change and ignore status codes
117
- --exec -e # run some shell command on success;
118
- --interval -i # milliseconds between one round of commands [default: 200]
119
- --forever -F # do not exit ever
120
- --service -S # create systemd user service with same parameters and activate it
121
- --version -v # print the version of await
122
- --autocomplete-fish # output fish shell autocomplete script
123
- --autocomplete-bash # output bash shell autocomplete script
124
- --autocomplete-zsh # output zsh shell autocomplete script
125
-
126
-
127
- NOTES:
128
- # \1, \2 ... \n - will be subtituted with n-th command stdout
129
- # you can use stdout substitution in --exec and in commands itself:
130
- await ' echo -n 10' ' echo -n $RANDOM' ' expr \1 + \2' --exec ' echo \3' --forever --silent
131
-
132
-
133
- EXAMPLES:
134
- # action on specific file type changes
135
- await ' stat **.c' --change --forever --exec ' gcc *.c -o await -lpthread'
136
-
137
- # waiting google (or your internet connection) to fail
138
- await ' curl google.com' --fail
139
-
140
- # waiting only google to fail (https://ec.haxx.se/usingcurl/usingcurl-returns)
141
- await ' curl google.com' --status 7
142
-
143
- # waits for redis socket and then connects to
144
- await ' socat -u OPEN:/dev/null UNIX-CONNECT:/tmp/redis.sock' --exec ' redis-cli -s /tmp/redis.sock'
145
-
146
- # lazy version
147
- await ' ls /tmp/redis.sock' ; redis-cli -s /tmp/redis.sock
148
-
149
- # daily checking if I am on french reviera. Just in case
150
- await ' curl https://ipapi.co/json 2>/dev/null | jq .city | grep Nice' --interval 86400
151
-
152
- # Yet another server monitor
153
- await " curl 'https://whatnot.ai' &>/dev/null && echo 'UP' || echo 'DOWN'" --forever --change\
154
- --exec " ntfy send \'whatnot.ai \1\'"
155
-
156
- # waiting for new iPhone in daemon mode
157
- await ' curl "https://www.apple.com/iphone/" -s | pup ".hero-eyebrow text{}" | grep -v 12' \
158
- --change --interval 86400 --daemon --exec " ntfy send \1"
104
+ await [options] commands[0m
105
+ [0m
106
+ [33m# runs list of commands and waits for their termination[0m
107
+ [0m
108
+ [0m
109
+ EXAMPLES:[0m
110
+ [33m# wait until your deployment is ready[0m
111
+ await ' curl 127.0.0.1:3000/healthz' \ [0m
112
+ ' kubectl wait --for=condition=Ready pod it-takes-forever-8545bd6b54-fk5dz' \ [0m
113
+ " docker inspect --format='{{json .State.Running}}' elasticsearch 2>/dev/null | grep true" [0m
114
+ [0m
115
+ [33m# action on specific file type changes[0m
116
+ await ' stat **.c' --change --forever --exec ' gcc *.c -o await -lpthread' [0m
117
+ [0m
118
+ [33m# waiting google (or your internet connection) to fail[0m
119
+ await ' curl google.com' --fail[0m
120
+ [0m
121
+ [33m# waiting only google to fail (https://ec.haxx.se/usingcurl/usingcurl-returns)[0m
122
+ await ' curl google.com' --status 7[0m
123
+ [0m
124
+ [33m# waits for redis socket and then connects to[0m
125
+ await ' socat -u OPEN:/dev/null UNIX-CONNECT:/tmp/redis.sock' --exec ' redis-cli -s /tmp/redis.sock' [0m
126
+ [0m
127
+ [33m# lazy version[0m
128
+ await ' ls /tmp/redis.sock' ; redis-cli -s /tmp/redis.sock[0m
129
+ [0m
130
+ [33m# daily checking if I am on french reviera. Just in case[0m
131
+ await ' curl https://ipapi.co/json 2>/dev/null | jq .city | grep Nice' --interval 86400[0m
132
+ [0m
133
+ [33m# Yet another server monitor[0m
134
+ await " curl 'https://whatnot.ai' &>/dev/null && echo 'UP' || echo 'DOWN'" --forever --change\ [0m
135
+ --exec " ntfy send \'whatnot.ai \1\'" [0m
136
+ [0m
137
+ [33m# waiting for new iPhone in daemon mode[0m
138
+ await ' curl "https://www.apple.com/iphone/" -s | pup ".hero-eyebrow text{}" | grep -v 12' \ [0m
139
+ --change --interval 86400 --daemon --exec " ntfy send \1" [0m
140
+ [0m
141
+ [0m
142
+ OPTIONS:[0m
143
+ --help [33m#print this help[0m
144
+ --stdout -o [33m#print stdout of commands[0m
145
+ --no-stderr -E [33m#surpress stderr of commands by adding 2> /dev/null to commands (doesn' t work with pipes)[0m
146
+ --silent -V [33m#do not print spinners and commands[0m
147
+ --fail -f [33m#waiting commands to fail[0m
148
+ --status -s [33m#expected status [default: 0][0m
149
+ --any -a [33m#terminate if any of command return expected status[0m
150
+ --change -c [33m#waiting for stdout to change and ignore status codes[0m
151
+ --exec -e [33m#run some shell command on success;[0m
152
+ --interval -i [33m#milliseconds between one round of commands [default: 200][0m
153
+ --forever -F [33m#do not exit ever[0m
154
+ --service -S [33m#create systemd user service with same parameters and activate it[0m
155
+ --version -v [33m#print the version of await[0m
156
+ --autocomplete-fish [33m#output fish shell autocomplete script[0m
157
+ --autocomplete-bash [33m#output bash shell autocomplete script[0m
158
+ --autocomplete-zsh [33m#output zsh shell autocomplete script[0m
159
+ [0m
160
+ [0m
161
+ NOTES:[0m
162
+ [33m# \1, \2 ... \n - will be subtituted with n-th command stdout[0m
163
+ [33m# you can use stdout substitution in --exec and in commands itself:[0m
164
+ await ' echo -n 10' ' echo -n $RANDOM ' ' expr \1 + \2 ' --exec ' echo \3 ' --forever --silent[0m
159
165
160
166
```
161
167
0 commit comments