Check for IP Address changes on my Raspberry Pi
Script that is called from Cron
cat /home/pi/send_ip.sh
#!/bin/bash
echo -n "$(date '+%Y-%m-%d %H:%M') "
hostname -I | awk '{for(i=1;i<=NF;i++) if ($i ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) printf "%s ", $i; print ""}'
Run this in Cron
$ crontab -e
# +---------------- minute (0 - 59) # | +------------- hour (0 - 23) # | | +---------- day of month (1 - 31) # | | | +------- month (1 - 12) # | | | | +---- day of week (0 - 6) (Sunday=0) # | | | | | # * * * * * command to be executed # 0 8 * * * /opt/scripts/down.sh >> /home/pi/log/shade.log 2>&1 # 0 11 * * * /opt/scripts/up.sh >> /home/pi/log/shade.log 2>&1 1 7 * * * /home/pi/send_ip.sh | ssh shade@server "cat >> /home/shade/log/shade.log" 2>> /home/pi/cron_debug.log
Show the file on the server that logs the IP address each day
ls -l /home/shade/log total 4 -rw-rw-rw- 1 shade shade 2519 Sep 19 07:40 shade.log
Show the contents of the shade.log file
$ cat shade.log # log file for host IP of shade Raspberry Pi Started out as 192.168.1.118 Jun 9, 2025 2025-06-09 20:01 192.168.1.118 2025-06-10 07:01 192.168.1.118 2025-06-11 07:01 192.168.1.118
Get Internal and External IP and date and time





Niccolò Machiavelli famously stated,
On Grief and Grieving - Finding the Meaning of Grief Through the Five Stages of Loss