Community
OpenEnergyMonitor

Community

Use sync module manually

Tags: #<Tag:0x00007f6e0f58ecb8>

Hello,

I would like to know how to use sync module from the command line. As far as i can see, there is a comment on the bottom of the help page where it says:

To run the sync process manually:

cd ~/
cd sync
sudo php sync_run.php

However, if i run the command exactly as specified, nothing happens. Only the command outputs the next text:

SYNC: Starting
SYNC: Connected to Redis

Moreover, my question is, where should i specify the remote server and its credentials to connect when using the CLI method?

Using the web interface, the sync module is working fine.

Thanks in advance.

Nobody??

Sorry, no idea.

Hello @xavidpr4

When you run

sudo php sync_run.php

it just checks the redis queue that is populated by the web interface, if there is nothing in the queue the script just exists. This script is usually called by the emonPi/base service-runner script which is triggered by the web interface…

It’s not possible to issue sync module commands via command line at the moment Im afraid. You could manually create the redis queue items. To get an example of a queue item:

1. Disable service-runner

sudo service service-runner stop

2. Click to download or upload some feeds in the UI

3. Fetch the queue item manually e.g:

 redis-cli lpop sync-queue

that should print out a json that you could then rpush back into the queue and run sync_run.php…

Hello TrystanLea,

Thanks for your help.

Now, based on your reply, I have some doubts concerning in how it really works. I mean, you say that the script takes the configuration filled in the web ui, fields such as credentials and so on and then sync.

However, when using the web UI, you can choose between download and upload. Even, you can use a single feed download/upload. So, if you have all these options via web UI, how is the CLI script choosing between all these options?

Or maybe has a built-in default “download all” action and thats all?

There is any way to provide what kind of sync I would like to perform with the sync-run.php?

Thanks in advance!