At home I track all my account transactions in a spreadsheet. When I went on vacation, I had to keep all the receipts to make sure they were entered into the spreadsheet when I returned home. That got me wondering if there’s a way to have access to the file while I am away from home. I started to think about the requirements and how I would update the file while I was away and make sure it synched up with the file at home.
I could have just kept the file on my Box.com account and accessed it from there. But that would pose challenges with locks placed on the file that may not be cleared. So I decided to have two copies of the file; one is stored on my NAS at home and the other is on Box.com. To make sure these files are kept in synch, I created a bash script that is run every 15 minutes by cron. This will check the files to see if there have been any changes, and if so it determines which one is older and overwrites the older one with the newer one. Also I have it send me an email when one of the files are overwritten.
You can view the complete bash script here or download the text file.