Community
OpenEnergyMonitor

Community

Import script (very) silently failing

Tags: #<Tag:0x00007f6e09a30808> #<Tag:0x00007f6e0e2439b0>

Hello,

I just migrated my Pi to the latest SD image and had to import a backup from my old emonpi. Unfortunately, although the backup went well, the downloaded file got corrupted somehow and failed to uncompress… but did not show any errors ! Some of my backuped feeds were corrupted but I only noticed it after a day because data was not displayed correctly and I get some errors inn emoncms logs complaining about missing meta file.

There is no error checking in the script and it seems that standard error output is not showed / trapped in the log file probably due to the way php is launching the script. So there was no way to know something went wrong and the import script happily reports everything is ok :frowning2:

Errors are displayed when running the script manually.

So I modified the script (mainly added some return codes tests and redirecting error to standard output) but I did not find any “best practices” to propose my updates… Should I just send a pull request ?

Thanks.
JS

Hi Js,

Very sorry to hear, thanks a lot for helping to debug.

How largest is your backup file? Could it be the data partition is running out of space? Can you see how much space is reminding be looking at the chart on the admin page of the new image local emoncms?

Yes a PR to enable more user-friendly verbose output would be great.

Hello Glyn,

I think the tar.gz file got corrupted when I downloaded it from my old emoncms. I restarted the image on another Pi and download it using SCP. File was a bit bigger and uncompressed correctly. So it is just bad luck on first download. Nothing that could have been prevented really.

But import script should have noticed the file was corrupted and complained about it as tar command failed after uncompressing some files.

I’ll do a PR with my proposed modifications.
JS

1 Like