I found a bunch of what seem complicated answers for how to do this. I made my own eventually just using bash and adding it to /etc/rc.local, turns out I didn’t need to have it in rc.local either, if I put it in /etc/network/if-up/ and made it executable.
#Send an email with the local IP
#sleep added to give me a wait to the process during boot and before remove to give the #script some time to run. These may not be needed. Adjust as needed.
#grep -v added to trim out some extra info from the file
#date added so it would append a time stamp to file
ifconfig | grep inet | grep -v inet6 | grep -v 127.0.0.1 >> file.tmp | date >> file.tmp
#-s after mail gives me a subject line
echo “$(cat file.tmp)” | mail -s IPaddress <firstname.lastname@example.org>
I added this line to /etc/rc.local, but I was getting two copies of the email on boot up. So I deleted it.
If I wanted my external IP I could add a line like below. Maybe put a line in cron to run the script every so often and get this info at times other than when I boot the Pi or when renewing the IP.
So I got this idea online to make my own terminal server with a Raspberry Pi and ser2net.
UGREEN USB to Serial RS232 Cable Adapter 4 Ports DB9 Converter 9-Pin Male to Male with Hexnuts
Raspbian Stretch Lite I’m running this on Buster now
I think a Pi Zero could also do the job and save a few dollars. So far it remembers the port numbers on reboot and my config is good but I’m working on getting the logging to work the way I want it.
Install ser2net running Raspbian Stretch:
apt-get install ser2net Then edit /etc/ser2net.conf with your USB to information that I got from running “dmesg | grep tty”.
[ 4.518967] usb 1-1.5.1: pl2303 converter now attached to ttyUSB0 [ 4.523283] usb 1-1.5.2: pl2303 converter now attached to ttyUSB1 [ 4.535015] usb 1-1.5.3: pl2303 converter now attached to ttyUSB2 [ 4.539260] usb 1-1.5.4: pl2303 converter now attached to ttyUSB3