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 if onedrive is idle #1213

Closed
dbazza opened this issue Jan 3, 2021 · 3 comments
Closed

Check if onedrive is idle #1213

dbazza opened this issue Jan 3, 2021 · 3 comments

Comments

@dbazza
Copy link

dbazza commented Jan 3, 2021

Hi.
I'm trying to develop a gnome shell extension for onedrive (https://extensions.gnome.org/extension/3919/one-drive/).
I need to know if onedrive running as a user service is idle or is downloading/uploading some files.
I look for this information with commands like:

  systemctl --user status onedrive
  journalctl --user-unit=onedrive -f

I see lots of information but not clear if service downloading/uploading or not in a moment.
A solution should be add if service is idle in systemctl status I think or a way to see the current
file in download/upload with a specific command.

Thanks in advance!
Diego Bazzanella

@abraunegg
Copy link
Owner

abraunegg commented Jan 3, 2021

@dbazza
Firstly, please can you fix up your documentation. This is wrong:

To use this extension you have to install unofficial abraunegg onedrive client (https://github.com/abraunegg/onedrive) on your dekstop. On ubuntu run "sudo apt-get install onedrive" then install this extension

This is 100% incorrect. Yes, the client is in the 'Universe' list, but is old and should not be used. You should only be using sudo apt-get install onedrive if you are using the Ubuntu PPA as per this advice. Please update your documentation so that the correct information is provided. Right now, if someone follows your advice, they could get any version from 1.1.3 -> 2.4.6 .. all of which contain issues and defects which have been resolved. If you wish to fix this, so that a PPA does not need to be used, then please become the Ubuntu packager and fix this situation.

As for your request, implementing a new command to do this is not exactly possible as the application is currently a single threaded application (see #232) and work is going on to totally re-engineer this client, but that is slow progress as everything including how the access to OneDrive is done needs to be re-written. Re-running the application to determine if another process / thread is active doing something is also just not possible.

To determine if the client is idle, uploading/downloading or performing a sync, you can look for a number of things in the log file - but users can change these default options to make the client more quiet, more verbose which will make your job harder. Things to look for are:

  1. When the application is syncing (scanning local disk & OneDrive for changes, which occurs every 'monitor_interval'), look for the following:
    • Starting a sync with OneDrive
    • Syncing changes from OneDrive ...
    • Sync with OneDrive is complete
      But this output is also governed by 'monitor_log_frequency' which has a default of 5, which means 1 out 5 syncs you will see this information unless you change 'monitor_log_frequency' to 1
  2. When in monitor mode (--monitor), uploads are governed by 2 events:
    • A 'inotify' system call if the filesystem supports 'inotify' - smb, nfs mounts do not support this
    • A new file detected as part of the sync sequence outlined above
      A new file upload will be referenced in the log file as Uploading new file ...
  3. When in monitor mode (--monitor), downloads only occur during the sync process outlined above and the following will be in the log file:
    • Downloading file ....

My advice to you at the moment is to:

  • Use journalctl --user-unit=onedrive and see what the last log entry line is, then depending on that line, make a determination in your app as to if the client is in an active or idle state:
    • Last line contains Starting a sync with OneDrive or Syncing changes from OneDrive ... = 'syncing'
    • Last line contains Sync with OneDrive is complete = 'idle'
    • Last line contains Downloading file = 'downloading'
    • Last line contains Uploading new file = 'uploading'

This is your only and best option at the moment

@dbazza
Copy link
Author

dbazza commented Jan 3, 2021

Thank you! I've already corrected my bad documentation and I'll update my software as you suggest.

@dbazza dbazza closed this as completed Jan 3, 2021
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants