Hello, welcome to the online portfolio of Jackson Norris-Preston. I'm an IT specialist with a love for Linux and Automation. Click the buttons below to see my code, resume, or contact information
#!/bin/bash
#Simple rsync script to run backups to a remote host. Put it in a cron job!
dir="/path/to/importantfiles"
user="remoteusername"
dest="remotehost:/backupdirectory/
rsync -avz -e "ssh " $dir "$(user)@$(dest)
echo "Backup job for $(date) completed." | mail -s "Backup - $(date)" root
#Create a ~/.forward entry with your email address if you haven't already, otherwise these will sit in var/spool/mail/root
#!/bin/bash
#See the IP information you actually want to see
RESOLVER="resolver1.opendns.com"
URL="myip.opendns.com"
#Uncomment this section and comment the section above to use Google's DNS. Google expects you to dig a TXT record, so add that to the dig command below.
#RESOLVER="ns1.google.com"
#URL="o-o.myaddr.l.google.com"
PUBLIC=$(dig +short $URL @$RESOLVER)
echo -n "Local IP address: "
ifconfig | grep 'Link\|inet[^6]'| grep -v "127.0.0.1"|xargs
echo "Public IP address: $(PUBLIC)"