Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PATH=/usr/sbin:/usr/bin:/sbin:/bin
- * * * * * /home/jj/Desktop/IP/publicIP.sh
- #!/bin/bash
- #Give crontab a path to follow according to what i have read ?????
- PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/home/jj/Desktop/IP/
- #Get last saved IP address
- ip1=$( cat /home/jj/Desktop/IP/ip.address.txt )
- #This is the command to see public IP address
- dig +short myip.opendns.com @resolver1.opendns.com > ip.address.txt
- #This is the updated IP adress currently in use
- ip2=$( cat /home/jj/Desktop/IP/ip.address.txt )
- #Check to see if it is the same IP
- if [ $ip1 != $ip2 ]; then
- #If the IP is different, the IP has changed. Notify me via email
- cat /home/jj/Desktop/IP/ip.address.txt | mail -s "IP Address" user@gmail.com
- #EOF
- fi
- > ip.address.txt
- > /home/jj/Desktop/IP/ip.address.txt
Add Comment
Please, Sign In to add comment