vishnubob / wait-for-it

Pure bash script to test and wait on the availability of a TCP host and port
MIT License
9.39k stars 2.27k forks source link

Script timesout (No such file or directory) while running with bash command #125

Open FAR5HID opened 2 years ago

FAR5HID commented 2 years ago

System: fedora 35

Trying to run the script without +x execution permission using bash command. bash wait-for-it.sh google.com:80

timeout: failed to run command ‘wait-for-it.sh’: No such file or directory
wait-for-it.sh: timeout occurred after waiting 15 seconds for google.com:80

(The error message is same for above case even if execution permission is given)

But it works when directly executed given +x. ./wait-for-it.sh google.com:80

wait-for-it.sh: waiting 15 seconds for google.com:80
wait-for-it.sh: google.com:80 is available after 1 seconds

Any way I can use the script without giving it execution permission?

svex99 commented 1 year ago

It works when you give +x permissions and use ./ because that is the intended behavior by the system.

Check the accepted answer for details: Why do I need to type ./ before executing a program in the current directory?

I don't think you can execute it without the required permission.

FAR5HID commented 1 year ago

I get that, about the path issue. Turns out the script calls itself during execution, for that it needs the +x permission.