How can I view Rclone File Backup Percentage with Python and JavaScript

I use Js, Python, ajax, jQuery for Rclone. I'm stuck in a small place.

rclone copy local/path remote_name: -P

Python runs this command on the command line (with the "subprocess" class) and outputs it.

There is a problem, the output is constantly changing as a percentage. So think of an upload percentage and it's constantly being updated.

I need to pull this percentage with Python and print it with Javascript and this should be instant.

I know Python well. But my knowledge of Javascript, ajax and jQuery is not enough, but I can do it by researching.

Thank you in advance for your help.

hi,
perhaps this can help
https://rclone.org/rc/#core-stats

2 Likes

Could you use the RC API to get that data rather than attempting to parse the standard out?

https://rclone.org/rc/

2 Likes

Unfortunately I don't understand how to use it exactly.

You add these to the command line of your sync:

--rc
--rc-no-auth (if you dont need authentication and you're not exposing this outside)

That will start a api on http://127.0.0.1:5572/. While that is syncing, you can execute posts to the API to gather information about the sync.

rclone rc core/stats

as an example.

https://rclone.org/rc/#api-rc

You can also pass parameters and other things.

You could also run the 'actual sync' from rc and then use that same rc to monitor it. For that, you'd start a rc daemon ( --rc-serve) first without syncing, issue the rc commands to sync, and then core_stats to monitor it.


root@xxxx:/data/bin# rclone rc --url=http://xxxx:xxxx@127.0.0.1:6444 core/stats
{
	"bytes": 0,
	"checks": 0,
	"deletedDirs": 0,
	"deletes": 0,
	"elapsedTime": 0.000019366,
	"errors": 0,
	"eta": null,
	"fatalError": false,
	"renames": 0,
	"retryError": false,
	"speed": 0,
	"totalBytes": 0,
	"totalChecks": 0,
	"totalTransfers": 1,
	"transferTime": 0.003379822,
	"transfers": 1
}
1 Like

I don't really know enough about API. At the same time, the system I use is a minimal system, so I will not be able to open a browser. Unfortunately it won't work if you need to open a browser. For now, I will try to create a conf file and write the percentages there, I hope I can. If I can't do it with this method, I think I will write to the forum again. Because my only option will be API and I'm troubled about it. Thank you for your interest

hi,
there is no need for a web browser, just command line.

  1. start the copy command
    rclone copy local/path remote_name: -P --rc --rc-no-auth
    look at the output and you should see NOTICE: Serving remote control on http://localhost:5572/
  2. get the stats
    rclone rc core/stats
1 Like

Yes. I tried what you said. But I guess it doesn't give the total percentage. It gives you what percentage of the files were discarded one by one. A calculation can be made from here, but it can make it quite complicated.

Is there a command where I can get the total percentage of the transfer?

@ncw I would really appreciate it if you are interested. I've been working on rclone for weeks.

And finally when I tried to do it with config file, it queued other processes. What I want to do is to make a backup so that it does not interfere with any other operation.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.