I want to know my Public IP address of PI using script and script should be start running automatically when my raspberry pi boot and Store output in some file, so that i can use later on.
Actually, I am Controlling my PI Remotely from Cloud and for that whenever Public IP of PI change then PI should be able to inform new IP to cloud. For that i need script that start automatically after boot and run every 5-10 second and check Public IP and overwrite output file.
sudo curl icanhazip.com for check public IP but that give me
actually i need only public IP without extra information, is there any command that give me only public IP and for looping a script i use While loop. Is it a right way or is there another better way to run screen in a loop.