Schedule a Zotero Sync
Hello Everyone,
I was wondering if there was a way to automatically schedule the zotero standalone client to synchronize on a linux computer?
I'm working on creating a standalone central backup computer and my last step is coming up with a way to schedule the synchronization.
I was hoping that there would be a command-line argument I could pass to the standalone app that would trigger the sync, but so far no luck.
The brute force solution would be to start the standalone client one hour before the backup and hope it completes in time.
Any hints would be appreciated. I'm a developer so if code is the answer I can look there as well.
Thanks.
mark.
I was wondering if there was a way to automatically schedule the zotero standalone client to synchronize on a linux computer?
I'm working on creating a standalone central backup computer and my last step is coming up with a way to schedule the synchronization.
I was hoping that there would be a command-line argument I could pass to the standalone app that would trigger the sync, but so far no luck.
The brute force solution would be to start the standalone client one hour before the backup and hope it completes in time.
Any hints would be appreciated. I'm a developer so if code is the answer I can look there as well.
Thanks.
mark.
Zotero.Sync.Server.sync()
or:
Zotero.Sync.Runner.sync({ background: true });
But like you said the app needs to be running for that to work. Maybe the Web API is the way to go?
Would there be any danger backing up the zotero folder while zotero was mid-sync?
If not I think leaving zotero running would be a decent solution, maybe I'll write another cron job that will check to make sure that zotero is running, and if not launch it, just in case there is a reboot or a crash.
For my purposes, I'd love to see a command line switch, or a standalone app that we could use to easily trigger a synchronization programatically.
Thanks Dan and Adam!
mark.
#!/bin/bash
case "$(pidof zotero | wc -w)" in
0) echo "Restarting Zotero"
cmd="zotero"
eval "${cmd}" &>/dev/null &disown
;;
1) echo "Zotero already running"
;;
esac
This checks to see if zotero is running, and if not starts zotero and then exits.