Update old backup to directory to update

Hello, i am trying to update mycodo with a backup i saved in my computer.
When i go to the section of backup/restore only appears the ones i did in these raspberry. But i want to update the other old backup.
I tried to copy this via ssh with the command:
scp [source files] [user]@[host]:[path]
C:\Users\ser6io>scp C:\Users\ser6io\Mycodo_Backup_2022-05-09_22-32-56-8.13.9_raspberrypi_.zip pi@192.168.18.186:Mycodo
pi@192.168.18.186’s password:
Mycodo_Backup_2022-05-09_22-32-56-8.13.9_raspberrypi_.zip 100% 32MB 1.2MB/s 00:26

It looks succesfull.
Then i tried to do the commands at ssh:
sudo /bin/bash ~/Mycodo/mycodo/scripts/upgrade_commands.sh backup-restore <restore_backup>

pi@raspberrypi:~ $ sudo /bin/bash ~/Mycodo/mycodo/scripts/upgrade_commands.sh backup-restore Mycodo/Mycodo_Backup_2022-05-09_22-32-56-8.13.9_raspberrypi_.zip
Directory does not exist

Could anyone help me with the directory?
what suppoust to be the directory of the file i uploaded before?

thanks for your help.

1 Like

You don’t need to do anything in a terminal. Just use Export Mycodo Settings Data as ZIP and Import Mycodo Settings Data from ZIP on the export/import page of the UI.

Make sure the Mycodo version you’re importing to is greater than or equal to the version you exported from.

i tried but it occurs:

Error: Import Settings: Invalid file name: Mycodo_Backup_2022-05-09_22-32-56-8.13.9_raspberrypi_.zip: 2022-05-09 != Settings
Error: Import Settings: Correct format is: Mycodo_MYCODOVERSION_Settings_DBVERSION_HOST_DATETIME.zip
Error: An error occurred during the settings database import.

A backup is not a settings archive. You must use the export option I mentioned, not a backup.

I did from here:

Import Mycodo Settings Data from ZIP

WARNING: MAKE A MYCODO BACKUP BEFORE ATTEMPTING A SETTINGS IMPORT!

This will allow a ZIP file containing the Mycodo settings database and custom functions/inputs/outputs/widgets to be uploaded and replace the current settings. Only databases from Mycodo versions equal or prior to the current Mycodo version should be imported. There is no check for this, but if you attempt to import a database from a version higher than the current Mycodo version, there will likely be issues. There may also be issues if the custom controllers are incompatible with the Mycodo version you’re importing in to.

Note 1: This will override all settings, user accounts, and custom functions/inputs/outputs/widgets, and log you out from the web UI. A backup of the current database will be created in the database directory (~/Mycodo/databases/mycodo.db.backup_DATE_TIME).

Note 2: During this process, the new database will be upgraded to the current Mycodo version and all unmet dependencies will be installed. This process can take a while to complete if there are a significant number of dependencies to install, so be patient.

and the program shows:

Error: Import Settings: Invalid file name: Mycodo_Backup_2022-05-09_22-32-56-8.13.9_raspberrypi_.zip: 2022-05-09 != Settings
Error: Import Settings: Correct format is: Mycodo_MYCODOVERSION_Settings_DBVERSION_HOST_DATETIME.zip
Error: An error occurred during the settings database import.

is something wrong with the name? i clicked on the folder that mycodo created from backup.

See my comment above that explains what you’re doing wrong:

sorrry, i was pointing to the final thinking from the backup you can restore.

Mis discupas

Then is no possible to restore from a backup created by other device, is what i suppose now.

It’s certainly possible, as a backup is the entire Mycodo directory that has been compressed to an archive file. A settings export file is merely an archive of the most minimal components necessary to restore a system. I have never taken a backup archive and attempted a restore, so I cannot give you an exact set of commands that I know will work, but essentially you should be able to follow these steps:

  1. Transfer the backup archive to your remote system
  2. Extract the archive to ~/Mycodo making sure that directory doesn’t already exist
  3. If Mycodo has been previously installed on the system, run ~/Mycodo/mycodo/scripts/upgrade_post.sh
  4. If Mycodo has not been previously installed on the system, run ~/Mycodo/install/setup.sh

That was not clear for me too!
I am trying to create a backup, so anyone can recovery this as a template to install the same things as me!
I could not understand how the backup system works to recovery everything from an empty mycodo installation. Could you made it more clear, starting from how to generate a backup on the mycodo page (/backup)

1 Like

Also, will this install previous custom add-ons, custom inputs, dependencies, etc?

1 Like
  • On the system you want to save, go to the export/import page (URL /export), press Export Settings, and save the file.
  • On the system you would like to setup the same as the system you just exported from, go to the export/import page, load the file you just saved, and press Import Settings.

Yes

I can certainly add better errors that will indicate when you’ve uploaded the wrong file, but more importantly, I can add the ability to import backup archives, which will then allow you to use the Restore Backup functionality on the Backups page for the backup archive you just imported.