i can't figure it out how to do this and all other tutorials are outdated and i have not some options they do (like a check box next to the time to set variable). so please don't mark this question as duplicate.

with that said; i have a profile which turn WiFi on when i unlock my phone. i want that to also ping Google DNS and if it get time out turn WiFi off if not keep the wifi connected.


You can create a task to ping Google DNS as follows:

Task → Code → Run Shell

Command: ping -c 2 [Store Output In: %stdout] [Continue Task After Error: checked]

If %stdout ~ 100% packet loss

google servers unreachable


connectivity established

End If


Add this to your main task with either keeps wi-fi conection or switches it off.


Run shell 'ping' with tasker

  • when wifi is on but not connected it give me the message "device connected" how cam i fix that? – ElectronSurf Jul 29 '18 at 3:21
  • 07.48.07/E Run Shell: %stdout -> %stdout 07.48.07/E Run Shell: -> 07.48.07/E Run Shell: -> 07.48.07/Shell runBackground ping -c 2 root: false timeout: -1 07.48.07/Shell start process-thread ID 813 07.48.07/E add wait type Shell1 time 2147483647 07.48.07/E add wait type Shell1 done 07.48.07/E add wait task 07.48.07/Variables doreplresult: |%stdout| -> |%stdout| 07.48.07/E Error: 2 – ElectronSurf Jul 29 '18 at 3:22
  • This task, produces an error when the device can;t ping, thus you have to tick "continue on error, in the task to prevent this...The flash message "Devie connected"is a customised text just to indicate that it has successfully pinge to google DNS you could replace this text with any useful message to indicate a succssful ping – xavier_fakerat Jul 30 '18 at 16:47

You don't need the complexity and performance hit of "shelling out", you can do this with Tasker native commands. Use command "http get", then check the HTTP return code in %HTTPRC (or sonething like that:-).

  • 3
    It would help if you could add a bit more steps making it easy for new Tasker users to follow too. :-) – Firelord Nov 30 '18 at 18:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.