Create Trigger to use macOS terminal to Ping domain
-
Sorry, I think I may have posted this request twice:
Very New. Was wondering how to create a trigger to do the following on my macOS
Run a ping request in terminal
2)Return results for one value -
For example, if I ping a domain name I want the value coming back with the FROM IP address.My goal is to get the returned IP address from the domain name as a value so that I can use the local trigger in Microsoft Azure Logic Apps action TRIGGER CMD.
-
@kbnetguy, this command should work on a Mac:
dig +short www.triggercmd.com | tail -n1
I included the tail -n1 to use only the first line in case the host name returns multiple IP's.
You probably know this, but to assign the result to an environment variable you can do this:
export IP=$(dig +short www.triggercmd.com | tail -n1) echo $IP
If you must use ping, let me know. I had that command figured out for Linux, but Mac's ping and grep are different.