I'm currently utilising a cron job which runs a backup script every evening to back up my documents to a networked machine over ssh, using rsync. The contents of my backup script:
#! /bin/bash rsync -vaz --progress -s -e "ssh" /store/Documents user@server:/home/user/Backup
and my crontab:
0 20 * * * /home/user/backup.sh > /home/user/backup.log
Obviously this will only work while I am connected to my home network, and the networked computer is available. I would like to either edit my script or cron job to only run when connected to my home network. How would I go about doing this?
Running Ubuntu Mate 16.04.2.
Any help much appreciated.