Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /bin/sh
- # ---------------------------------------
- # INSTALL AND CONFIGURE SMTP / GMAIL
- # ---------------------------------------
- # WARNING: YOU WILL BE REQUIRED TO CHANGE
- # YOUR GOOGLE ACCOUNT SETTINGS AND
- # ENABLE ACCESS FOR LESS SECURE APPS
- # ---------------------------------------
- # Install the necessary packages
- # sudo apt-get update
- # sudo apt-get install mailutils ssmtp
- # Edit the ssmtp configuration file
- # sudo nano /etc/ssmtp/ssmtp.conf
- # Change the mailhub to
- # mailhub=smtp.gmail.com:587
- # Add the following lines to the end of the file
- # AuthUser=yourgmailaddress@gmail.com
- # AuthPass=yourgmailpassword
- # UseSTARTTLS=YES
- # Edit the revaliases file
- # sudo nano /etc/ssmtp/revaliases
- # Add the following line to the end of the file
- # root:yourgmailaddress@gmail.com:smtp.gmail.com:587
- # Test the above configuration with the following command
- # sudo echo testtext | mail -s testsubject yourgmailaddress@gmail.com
- # Create an empty text file in your home directory and call it ip.txt
- # Put this script in your home directory
- # And make this script executable
- # chmod u+x ipmailer.sh
- # Edit the cron table
- # sudo crontab -e
- # Add the following line to the end of the file
- # @reboot /home/pi/ipmailer.sh &>/dev/null
- # Reboot your Raspberry Pi
- # sudo shutdown now -r
- SUBJ="Raspberry Pi IP Address"
- EMAIL="yourgmailaddress@gmail.com"
- IP=$(wget -qO- ifconfig.me/ip)
- WLAN0=$(/sbin/ifconfig wlan0 | grep "inet " | awk -F'[: ]+' '{ print $4 }')
- # Uncomment the following line to store your internal ethernet address in a variable
- # ETH0=$(/sbin/ifconfig eth0 | grep "inet " | awk -F'[: ]+' '{ print $4 }')
- echo "PUBLIC: $IP" > /home/pi/ip.txt
- echo "WLAN0: $WLAN0" >> /home/pi/ip.txt
- # Uncomment the following line to append your internal ethernet address to the text file
- # echo "ETH0: $ETH0" >> /home/pi/ip.txt
- cat home/pi/ip.txt | mail -s "$SUBJ" $EMAIL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement