I take a lot of pictures. up until recently I just downloaded them manually into my computer. but following the tech trends I have moved to uploading my phone photos to the google photos cloud.
to be honest, I trust google engineers to do better job than me in backing up thier servers and making sure I don’t loose all those memories. but still I wanted to hace a local copy.
I’ve upgraded my home server to FreeNAS and thought it was a great operatunity to use it’s cloud backup options, when google threw an unexpected surprise. they are splitting up google photos and google drive, which was the only way to access these photos from another server.
So I’ve dug the internet and found a great script called gphotos-sync which does “Google Photos and Albums backup with Google Photos Library API”. cool ! It uses the direct photos API so no need for the drive-photos link. I’ve made a few tweeks (now part of the official repository) to the code, so I can still use my current directory structure (which was created by good old but deprecated picasa 3)
Next task was making it work as a scheduled task on FreeNAS. While I am a savvy user of many OS’s, I’m quite new to FreeNAS so maybe there is a nicer way to do it, and you’re encouraged to leave comments below. But here’s what worked for me….
I’ve created a new jail, dubbed “cronjail”, installed gphoto-sync as per it’s instractions and mounted my shared picture pool in
/mnt/pictures. Next I’ve wrote the following script:
cd /root/gphotos-sync pipenv-3.6 install pipenv-3.6 run /root/gphotos-sync/gphotos-sync --skip-albums --use-flat-path --db-path=/mnt/pictures/_db --logfile=_db/gphotos.log --photos-path= /mnt/pictures/ > /root/log1.txt pipenv-3.6 run /root/gphotos-sync/gphotos-sync --skip-albums --use-flat-path --db-path=/mnt/pictures/_db2 --logfile=_db2/gphotos.log --photos-path= /mnt/pictures/ > /root/log2.txt
The first two lines are to avoid error messages I got when running the script. Again, I’m new to all this jail business.
Then I run gphotos-sync twice: one for my account, and one for my wife’s. So two account secrets and two databases If you only got one account and OK with the nested YYYY/MM directory structure, you can simplify the other parameters.
Last thing is to schedule the script regularly. Go to Tasks->Cron jobs and add a new job with the command
jexec 6 /root/gphotos_dl.sh > /root/dbg.txt don’t forget to change the jail number (in my case 6) to the correct one in your system
edit: you can replace the jail number with ioc-jailname