I am trying a very simple macro to execute a shell script that runs "nc" to check connectivity.
When I run the macro with "nc" to a destination that I have connecitivity to, things work (i.e. result window pops up, and subsequent actions ran) - when the "Include Errors" is enabled. Example below
My challenge is that when the "nc" runs against a destination that I don't have connectivity to, i.e. either connection refused or timeout, the macro is stuck, i.e. no pop-up display result window and any subsequent actions will not run. Screenshot below
Including the shebang line in the script, i.e. "#!/bin/bash"
try other similar package, i.e. ncat, telnet.
The following is a screenshot of executing the command directly from Terminal.
I can run the shell script directly outside KM. But this is bugging me and would like to get it working with KM. (so that I can centralise all my script execution from KM).
Thank you, @_jims Your solution works like a charm:)
If possible, I’d very much like to understand why KM doesn’t trigger the pop-up result notification or subsequent action when using the script to directly run “nc” in the error scenarios. Any input on that would be much appreciated.
In Bash, 2>&1 is an operator that redirects stderr to the same destination as stdout; i.e., it merges the error output with the regular output. For more information, see: Bash — pipes and redirections. stdin, stdout and stderr