we can use ping shell command in tasker to see if a domain is online or not but can we get the ping time too? like in pc when you ping that shows a "time=xx" can we somehow access to that in tasker?

2 Answers 2

A1: Run Shell [ Command:ping -c 1 Timeout (Seconds):0 Use Root:Off Store Output In:%PING Store Errors In: Store Result In: Continue Task After Error:On ] 

A2: Variable Section [ Name:%PING From:88 Length:11 Adapt To Fit:Off Store Result In:%TEST ] 

A3: Flash [ Text:%TEST Long:On ] 

I get the response times like this:

ping -qc1 google.com 2>&1 | awk -F'/' 'END{ print (/^rtt/? "OK "$5" ms":"FAIL") }'

Example output: OK 1.038 ms

You could modify the output to get only the numeric value, so the output can be directly piped to a variable in tasker, eg: ping -qc1 google.com 2>&1 | awk -F'/' 'END{ print (/^rtt/? $5 : 0) }'

Exmaple output: 1.038 or in case of a failure: 0


credits: https://unix.stackexchange.com/questions/409203/ping-show-only-results

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .