Odrive Sync Agent: A CLI/scriptable interface for odrive's Progressive Sync Engine for Linux, OS X, and Windows

Here is the simplified version:

num_procs=4;find "$HOME/odrive-agent-mount" ! -name "*.cloud*" -type f -print0 | xargs -0 -n 1 -P $num_procs "$HOME/.odrive-agent/bin/odrive.py" unsync

Tony sent me this great script to sync all folders:
exec 6>&1;num_procs=2;output="go"; while [ "$output" ]; do output=$(find "[path to odrive folder to sync here]" -name "*.cloudf" -print0 | xargs -0 -n 1 -P $num_procs python $(ls -d "$HOME/.odrive/bin/"*/ | tail -1)odrive.py sync | tee /dev/fd/6); done

… but after running it again, I no longer get the 'real time output.'
Any idea why? It works, but no logging of items in Terminal.

Hi @Zero_G,
This isn’t something I have seen before. Possibly something with the file descriptor being used/still in use? You could try modifying the command to use a different df, like 7.

exec 7>&1;num_procs=2;output="go"; while [ "$output" ]; do output=$(find "[path to odrive folder to sync here]" -name "*.cloudf" -print0 | xargs -0 -n 1 -P $num_procs python $(ls -d "$HOME/.odrive/bin/"*/ | tail -1)odrive.py sync | tee /dev/fd/7); done

Yeah, that was the first thing I tried, but no dice. Not a big deal, but it was nice seeing the progress.

Really strange. Let me know if you happen to find a solution to it. Did you try the tried-and-true restart yet? :wink:

I tried all kinds of things, including closing the redirect with exec 6>&- but nothing worked.

Finally I rewrote it like this and this is more reliable for me:

num_procs=2; while [[ -n $(find . -name '*.cloudf') ]]; do find . -name "*.cloudf" -print0 | xargs -0 -n 1 -P $num_procs python $(ls -d "$HOME/.odrive/bin/"*/ | tail -1)odrive.py sync; done

No redirection hacks needed!

1 Like

i get this error:

odrive-sync-log.sh: riga 6: ~/Cloud/odrive/logs/20170917232456.odrive.log: File o directory non esistente
usage: odrive.py sync [-h] placeholderPath
odrive.py sync: error: too few arguments

with this bash script:

#!/bin/sh

log=`date "+~/Cloud/odrive/logs/%Y%m%d%H%M%S.odrive.log"`

echo sync started. check $log
time ~/.odrive-agent/odrive-script.sh | sh >> $log 2>&1

echo sync $log
echo -----
cat $log
echo -----
echo compressing log
gzip $log
echo sync completed

i can’t understand where is my mistake

Hi @william.melatini,
It looks like the find command in the odrive-script.sh is not finding any files to push to odrive to sync (basically, the list is empty). You should verify that the find command, by itself, is finding .cloudf files to sync.

4 posts were merged into an existing topic: Sync Agent RPI Urllib3-Error

A post was merged into an existing topic: Sync Agent RPI Urllib3-Error

Platform RPi: Is there a way to use the CLI interface for decryption?

Hi @shaiguitar,
Unfortunately encryption is not supported in the agent.

Thanks for the response. Is there a roadmap item to support this? I would really be in favor of this. I know there are a few forum discussions about decryption automation outside of odrive ( ie https://github.com/jordanbtucker/odrive-decrypt from some ), but:

  1. It’s not an official tool
  2. It’s not really tested (as stated in the README)
  3. It doesn’t handle a recursive “just get my ENCRYPT folder”.

Hi @shaiguitar,
There isn’t a roadmap currently, but I expect to see some form of support for this in the next generation product, although not on initial release.

I created some utilities, including a odrive decryption utility that has recursive capabilities. It’s not “official”, but I support it. https://github.com/amagliul/odrive-utilities

I’ve been pretty happy with odrive (really, a great concept & product!) but am at the point where I will likely cancel my subscription because encryption is not supported on linux. If it’s supported on Mac (posix-like) how hard can it be to port it to linux? I’m a little confused why it’s problematic, and since one of the main reasons for doing pro for me was encryption, it renders that membership meaningless if it’s not portable aross my devices. Just something to think about.

Shai

Hi @shaiguitar,
I definitely understand. The product team is aware of the unfortunate hole here and I will continue to poke them about it.

Does odrive2 support this?

Hi @shaiguitar,
Encryption is supported on Linux for odrive1 now.

A post was split to a new topic: Agent/CLI mounting

Hi all, one remark on the code for Linux. In “elementary OS” (which is an Ubuntu fork I believe) I had to remove the " " for the find command. And I had to add the “-exec python”.

Working example below. Hope it makes sense.

exec 6>&1;num_procs=4;output="go"; while [ "$output" ]; do output=$(find $HOME/odrive-agent-mount/'Amazon Cloud Drive'/ -name *.cloud* -print0 | xargs -0 -n 1 -P $num_procs -exec python "$HOME/.odrive-agent/bin/odrive.py" sync | tee /dev/fd/6);done

1 Like