Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check current sync status from command line #6345

Open
fabianostermann opened this issue Jan 11, 2024 · 3 comments
Open

Check current sync status from command line #6345

fabianostermann opened this issue Jan 11, 2024 · 3 comments

Comments

@fabianostermann
Copy link

fabianostermann commented Jan 11, 2024

Feature description

Hi all,

I am looking for a way to determine the current state of the nextcloud client (mainly: "syncing.." vs "all synced") in a bash script.
I use that to wait for syncing to end and then automatically trigger shutdown.
Dropbox, which I used for a long time, has a python script command for that: $ dropbox status
That just returns a string, that can be captured and interpreted.

If there isn't such a functionality in the nextcloud client (and my searches indicate nothing useful), I would like to give it a try.
For my use case, it could mean to just perform a hacky lookup of some log files (I saw I can enable logging to /tmp/Nextcloud-logdir/) or anything similar.
So has anyone, who is more into the code, an idea how to cleverly approach this for now?

Also, I would suggest to consider such a utility a super enhancement for this project. If a simple approach could be found for now, I would like to look into integrating this to the project in a smoother way.

Thx in advance for any suggestions!


The information I want to obtain seems to be stored in src/common/syncfilestatus.h

What happened to nextcloudcmd? Is src/cmd working or not? Sorry, but I cannot find up-to-date information about it. Thx!

@PhilippSchlesinger
Copy link

Similar request #6328

@fabianostermann
Copy link
Author

Good news. I came up with a quick solution! (Linux only)

I just borrowed some code from the syncstate nautilus-extension, which connects to a socket that communicates with the nextcloud client.
With this approach, all information that the socket provides (see here for all the possible requests) can be implemented.

I mirrored the behavior of the Dropbox command-line tool that is to print Up to date or Syncing.. whenever called. I decided to do so (for now), because I used Dropbox before and can reuse all my personal scripts this way (e.g. delaying shutdown when some syncing has not yet finished).

I have made the python script available here.

@diamantopoulos12
Copy link

@fabianostermann Thanks for the script! Works great on my Rocky 9 machine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants