[HOW TO] Synchronize Google Photo using "gphotos-sync" on QNAP TS-231P3 (and maybe others)

Post Reply
lukenpi
New here
Posts: 2
Joined: Thu Feb 25, 2021 12:47 am

[HOW TO] Synchronize Google Photo using "gphotos-sync" on QNAP TS-231P3 (and maybe others)

Post by lukenpi » Thu Feb 25, 2021 1:20 am

Hello!

Just spend few hours trying to figure out how to configure gphotos-sync on my brand new QNAP. I'd like to share you how did I succeeded, hoping this will save you some headhaces.

I won't explain how to configure gphotos-sync itself, there's a ton of topics out there which explain how to do that.

What you need:
  1. A configured app in your Google Developer Console
  2. The client_secret.json of the app
  3. SSH Enabled in QNAP Config
  4. Confidence with console. You could do serious damages if you don't know what you're doing, like delete your data or scrambling the QNAP config
So, let's start:
  1. Install Entware from App Center (this will enable OPKG)
  2. Login via SSH with admin, press Q then Y to go to the real console
  3. Run the following commands (to install dependencies, gphotos-sync and prepare the config folder)

    Code: Select all

    opkg install gcc pyhton3 python3-dev python3-pip
    pip3 install gphotos-sync
    mkdir -p /share/homes/admin/.config/gphotos-sync
  4. Paste your JSON file copied from Google Developer Console into

    Code: Select all

    /share/homes/admin/.config/gphotos-sync/client_secret.json
  5. Test it up by running

    Code: Select all

    HOME=/share/homes/admin gphotos-sync /share/YOUR_BACKUP_PATH
If you want (like me) schedule it via cron
  1. Edit /etc/config/crontab and add the following line (replace the real path)

    Code: Select all

    0 * * * * /opt/bin/gphotos-sync /share/YOUR_BACKUP_PATH >/share/YOUR_BACKUP_PATH/cron.log 2>/share/YOUR_BACKUP_PATH/cron.err.log
  2. Restart the crontab daemon with

    Code: Select all

    crontab /etc/config/crontab && /etc/init.d/crond.sh restart
And that's it! Easy-peasy... Sort of.
Last edited by lukenpi on Thu Feb 25, 2021 2:01 am, edited 1 time in total.

Mousetick
Been there, done that
Posts: 946
Joined: Thu Aug 24, 2017 10:28 pm

Re: [HOW TO] Synchronize Google Photo using "gphotos-sync" on QNAP TS-231P3 (and maybe others)

Post by Mousetick » Thu Feb 25, 2021 1:55 am

/root is volatile. Anything you put in there won't be there any more after restarting the NAS.

You can work around that by storing stuff in /share/homes/admin, ignoring /root entirely:

Code: Select all

# opkg install gcc pyhton3 python3-dev python3-pip
# pip3 install gphotos-sync
# mkdir -p /share/homes/admin/.config/gphotos-sync
Then put client-secret.json in /share/homes/admin/.config/gphotos-sync.

Then to run via cron: no changes to your instructions but skip symlink creation (#1).

Or to run via SSH logged in as admin user:

Code: Select all

# HOME=/share/homes/admin gphotos-sync /share/YOUR_BACKUP_PATH

lukenpi
New here
Posts: 2
Joined: Thu Feb 25, 2021 12:47 am

Re: [HOW TO] Synchronize Google Photo using "gphotos-sync" on QNAP TS-231P3 (and maybe others)

Post by lukenpi » Thu Feb 25, 2021 1:59 am

Mousetick wrote:
Thu Feb 25, 2021 1:55 am
/root is volatile. Anything you put in there won't be there any more after restarting the NAS.

You can work around that by storing stuff in /share/homes/admin, ignoring /root entirely:

Code: Select all

# opkg install gcc pyhton3 python3-dev python3-pip
# pip3 install gphotos-sync
# mkdir -p /share/homes/admin/.config/gphotos-sync
Then put client-secret.json in /share/homes/admin/.config/gphotos-sync.

Then to run via cron: no changes to your instructions but skip symlink creation (#1).

Or to run via SSH logged in as admin user:

Code: Select all

# HOME=/share/homes/admin gphotos-sync /share/YOUR_BACKUP_PATH
Just rebooted and found it out. Thanks for the tips, I'll update the original post ;)

Post Reply

Return to “Google Cloud Storage”