Simple Bash script that announces IP Address and ngrok tunnel of Raspberry Pi at boot
#No-Mo-Head
Here's a bit of background: I frequently use my Pi in headless mode, but I live in a college where the Wifi doesn't let you use static IPs. I've implemented a number of workarounds for this problem, but this is the one that stuck. If you can connect to the internet but have a problem connecting to the Pi, this could help.
First clone the repository (if you have git on your Raspi. If not, just download):
git clone https://github.com/hrishioa/nomohead.git
Don't install yet! Install ngrok first in a directory of your choice:
wget https://dl.ngrok.com/ngrok_2.0.19_linux_arm.zip
unzip ngrok.zip
(This was the linux release of ngrok when I wrote this. Do check for updates on the website)
We are going to tunnel into the SSH port of the Raspi using ngrok. For this functionality, you need to register with ngrok (if you haven't already), and authenticate yourself with the authtoken.
./ngrok authtoken <TOKEN HERE>
Next, run the install script:
./setup.sh
Setup asks for the following parameters:
Once all values are entered, a cron job is created that runs at boot.
At this point, you can reboot your Pi.
In order to find your raspberry pi, you can go to
http://dweet.io/follow/<RASPID>
or, in order to see all updates in 24 hours, go to
http://dweet.io/get/dweets/for/<RASPID>
and replace RASPID with the IP or Tunnel ID you gave during Setup. I prefer the former because it looks better, but it is certainly possible to run automated scripts that poll the JSON from the latter and do things once the Raspi comes online.