Monday, April 16, 2018

Synology and Dropbox Oddity

One thing I love about my Synology NAS is that it can stand double-duty for an always-on server within my house for long-running lightweight operations.  With the iPkg package manager giving access to nearly every command-line tool imaginable, it's often easier to fire up a screen session and have the NAS chug away at something.  Sure, my laptop could get things done in a fraction of the time, but the Synology's CPUs are idle 90% of the time so might as well put them to some use.  For example, I've had it concatenating MP4 files from my dash-cam and re-coding them for YouTube for the past week, using ffmpeg.

Recently, I was downloading some raw JSON data (tracking data for a friend's cross-country bicycle ride) via a cron script that just made an authenticated curl call to the relevant service.  I was saving the JSON data into the Dropbox folder on Synology with an eye to giving my friend access to that folder.  I verified the files were getting downloaded properly, but after a few days I noticed they're not showing up in any of my other Dropbox clients.

To cut a long story short, the files written within the cron job seem to avoid detection by the Cloud Sync service, and thus just sit there without being sync'ed.  The easy solution is to go back later and touch the files, which causes them to sync immediately, but this of course is a manual step in an automated process so is not ideal.  One could automate this hastily by having a bash script periodically touch all files in the folder, which you can persist via screen.  You could even get fancy and force identical timestamps if required.

That's good enough for this short-term project, but I'm curious if there is a better way to force sync these files.  Feel free to add your ideas in the comments.

No comments:

Post a Comment