You are not logged in.
Hi.
I am going away for one year and I want to be able to upload backup files to my linux box while I am gone.
BIOS wil boot the machine in the evenings and I will find a script or something to shut it off after two hours every day.
SSH is taken care of.
The thing is. I need to get the internet IP sendt to me by mail everytime the system boots, and I don't know how to do that.
I have been googeling some and found out about /etc/rc.d/rc.local
I tried using this script I found from another forum:
"ip addr | grep "inet " | grep -v "lo\$\|virbr0" | cut --delim=" " -f6 | cut -d/ -f1 | mailx -s "$(hostname) IP" someone@somewhere"
but it reports
/usr/sbin/sendmail: Ingen slik fil eller filkatalog "/home/<user>/dead.letter" 9/236 . . . message not sent.
Thanks for your help!
Last edited by pappbox (2011-08-14 18:09:05)
Offline
You need an MTA capable of relaying to another smtp server to send email. You could use something as simple as msmtp which would leverage an account you have with a provider like gmail.
Also... your pipeline makes me cry:
ip a show dev MYINTERFACE | awk '$1 == "inet" { split($2, a, "/"); print a[1]; }' | <mta>Replace MYINTERFACE accordingly.
Offline
Thanks for helping.
I just got to the realisation that the IP i need is the one from my internet provider. Not the one my broadband router is giving.
Can you think of any way to implement that in the mail that is going out?
Offline
Perhaps use the output from curl -s ifconfig.me.
aur S & M :: forum rules :: Community Ethos
Resources for Women, POC, LGBT*, and allies
Offline
Wrote a script for just this purpose. In the AUR: http://aur.archlinux.org/packages.php?ID=37553
Offline
Lovely! Thanks a lot!
Think I am good with google now to set this up.
Offline
I have installed your script now. Is there a way to test it before my ISP changes my IP address?
Offline
The best would actually be if I could get the system to send me a email everytime it boots. so I can know that it is still alive and up and running.
I think I going to try this first. To run a simple sendEmail command everytime the pc powers on.
But how can I make the simpleEmail script print the output of
curl -s ifconfig.me
in the email body?
Cheers!
Offline
Surely DynDNS + ddclient would be simplest?
Are you familiar with our Forum Rules, and How To Ask Questions The Smart Way?
BlueHackers // fscanary // resticctl
Offline
I have installed your script now. Is there a way to test it before my ISP changes my IP address?
Did you take a look at the code? Just change the contents of /usr/bin/checkip.sh ?
Just change the IP addy in ~/.oldip and run the script again.
Offline