Hello agian,
im using wireguard and im trying to send a mail when wan has a new ip adress (i cant choose my ip:().
i made a file 90-led on the /etc/hotplug.d/iface folder. with:
#!/bin/sh
wan_iface="eth0.300@"
check_if_wan_up="$(ip -br a | grep "$wan_iface" | grep UP)"
check_wan_IP="$(ip -br a | grep "$wan_iface" | grep -Eo '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"
tekst=""
if [ "$check_if_wan_up" != "" ] && [ "$check_wan_IP" != "" ]; then
tekst="$(echo "Subject: IP adress is Changed to:\r\n$check_wan_IP"|sed 's/$/:25565/')"
echo "$tekst" | sendmail -a default "<MY EMAIL>"
fi
a simple script that checks if wan is on then is there a ip adress.
if wan is not nothing and if ip_wan is not nothing then just email the ip adress of the wan.
But the mail i receive is the subject and the ip in the subject
i'm trying to make it like subject: the new ip adress is:
and the body: 120.123.1.32 (as a example)
the \r\n i changed for:
\
\n\n
\n
nn
n
Im stuck because everything i search on google the syntax shows up, i really dont know where im looking for or how to fix it.
If u know the solution or the search terms on google please let my know.
thanks in advance
Time spend on this problem 3hours now