I managed to save my generated_scripts from a corrupt database. How can i restore them?
As i remember the scripts are stored in the database and therefor it is not simple a matter of logging in with SSH and placing the files back in the 'generated_scripts' folder
I could copy/paste everything in the web browser, but I assume there is a better way
how to restore my 'generated_scripts'?
Moderator: leecollings
- waltervl
- Posts: 5384
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: how to restore my 'generated_scripts'?
I dont think there is another way. Perhaps store them directly in the database but it is probably as much as work as using the web interface. I have no clue how to do it. How many scripts do you have?
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Re: how to restore my 'generated_scripts'?
ok, thanks for the reply.
I have about 50 scripts, will take me an hour.
I have about 50 scripts, will take me an hour.
- gizmocuz
- Posts: 2394
- Joined: Thursday 11 July 2013 18:59
- Target OS: Raspberry Pi / ODroid
- Domoticz version: beta
- Location: Top of the world
- Contact:
Re: how to restore my 'generated_scripts'?
You could open both databases in a editor (like SQLite Expert Personal Edition) and copy/paste, but in the web interface is a good option.
50 scripts! Maybe you could simplify this a bit...
50 scripts! Maybe you could simplify this a bit...
Quality outlives Quantity!
-
- Posts: 643
- Joined: Thursday 10 November 2016 9:30
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: how to restore my 'generated_scripts'?
To avoid such issue in the future, you may also save your scripts as regular files in the right ~/domoticz/scripts subdir, using the right name convention for the script type (time, device...)? Some also experienced (never myself, Lua looks quite robust) script errors that hangs domoticz, so when such script is in DB loaded at domoticz startup getting it back to work is not as simple as moving/renaming a faulty script file!
Just don't forget scripts no more embedded in DB => need to also save theses script files if a full domoticz reinstall is needed someday.

50 scripts is also huge! On my side, complex scripts are dedicated to a function (like alarm) per file but I merged all very small ones in a common file per type (I have a script_time_allChecks.lua that merged several small Lua scripts for time triggered checks in a single file for instance): As Domoticz must load each files for a trigger type this is more efficient.
-
- Posts: 561
- Joined: Monday 20 March 2023 14:41
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Somewhere in NL
- Contact:
Re: how to restore my 'generated_scripts'?
I never store my scripts in the database, my dzVents script are ALL in the ~/domoticz/scripts/dzVents/scripts directory and there are 114 dzVents scripts totaling to 587Kb of scripts. My house is now almost autonomous, but still work (scripts) to do. My Raspberry is running fine. Am I way off now?
Logic will get you from A to B. Imagination will take you everywhere.
-
- Posts: 271
- Joined: Sunday 11 May 2014 11:09
- Target OS: Windows
- Domoticz version: 2023.1+
- Location: NL
- Contact:
Re: how to restore my 'generated_scripts'?
This .... as your db grows and you have that many scripts expect at some point to have the experience that domoticz will become slow.
I have one lua file containing all basic functions thats loaded at start of the script before opening the commandArrayPP{}
(into 5 time scripts and 5 device scripts) --> I am below 0.3 sec for all timescripts to finisch and 0.2 sec for the device scripts ...
I also started once with a separate script for every different purpose they are now together, when you smart combine them in functions its also easier to trouble shoot
Rpi & Win x64. Using : cam's,RFXCom, LaCrosse, RFY, HuE, google, standard Lua, Tasker, Waze traveltime, NLAlert&grip2+,curtains, vacuum, audioreceiver, smart-heating&cooling + many more (= automate all repetitive simple tasks)
-
- Posts: 320
- Joined: Thursday 01 November 2018 19:47
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2024.6
- Location: Portugal
- Contact:
Re: how to restore my 'generated_scripts'?
119 dzVents scripts(828kb), in the dB (35mB) , 864 used devices(1419 total). Slowed down a bit my old rpi3b but sits at 10-20% cpu these days with about 400mb memory use. I make sure to turn on full logging on occasion to check for loops and race conditions. I use monitorix to check overall status.
This is still my original dB from 2018 when I first started, I never had to rebuild.
Runs well, minimal lag these days.
This is still my original dB from 2018 when I first started, I never had to rebuild.
Runs well, minimal lag these days.
Intel NUC with Ubuntu Server VM (Proxmox),mosquitto(docker),RFXtrx433E,zwavejsUI (docker),Zigbee2mqtt(docker),SMA Hub (docker),Harmony Hub plugin, Kodi plugin,Homebridge(docker)+Google Home,APC UPS,SMA Modbus,Mitsubishi MQTT, Broadlink,Dombus
Who is online
Users browsing this forum: psubiaco and 0 guests