Use FreeNAS box to sync Dropbox data?

Status
Not open for further replies.

RichTJ99

Patron
Joined
Sep 12, 2013
Messages
384
Hi,

I am looking to figure a way to sync my dropbox data on my FreeNAS box. I am trying to figure out a way to do so. Maybe using virtualbox to do so?

Any suggestions would be great.

Thanks,
Rich
 
Last edited by a moderator:

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
I am running a Debian VM (Ubuntu or some other OS should be just as effective) with Dropbox installed with storage mounted via NFS. New files show up as quickly as expected. New data that I copy in within the VM is synced quickly as well. New data copied outside the VM, in FreeNAS space, does show up in the VM if I look for it, but it's not detected as new by Dropbox. So I wrote a script that looks for new data and touches it to update the access time. This is enough to notify Dropbox about the new data and it syncs. I run that script via the VM cron every five minutes.

I can post the script later today, but it basically looks for files that are new than a sentinel file that is outside the Dropbox folder. For any that are found it touches the containing folder with a time that is equal to the modification time of that containing folder. It then updates the sentinel as well.

The effect of this is that the modification time remains unchanged, but the access time changes. That's enough to notify Dropbox.
 

fracai

Guru
Joined
Aug 22, 2012
Messages
1,212
Here's the script that I'm using to notify Dropbox of files to sync.
I should note that by using the found directory as the reference time when touching that same directory the access and modification times don't change while the "change" time does.
Code:
#!/bin/bash

DROP_PATH="/home/fracai/Dropbox"
SENTINEL="$DROP_PATH-sentinel" # best to keep this out of the Dropbox folder

if [[ ! -f "$SENTINEL" ]]
then
	/bin/echo "sentinel not found: $SENTINEL"
	exit 1
fi

/usr/bin/touch "$SENTINEL"_start

/usr/bin/find "$DROP_PATH" -depth -type d \! -path "$DROP_PATH/.dropbox.cache" \! -path "$DROP_PATH/.dropbox.cache/*" | while read DIR
do
	if [[ $(/usr/bin/find "$DIR" -maxdepth 1 -cnewer "$SENTINEL" -print -quit) ]]
	then
		/usr/bin/touch -c -r "$DIR" "$DIR"
		/bin/echo "$DIR"
	fi
done

/usr/bin/touch -r "$SENTINEL"_start "$SENTINEL"
rm "$SENTINEL"_start
 
Last edited:
Status
Not open for further replies.
Top