Im working with Node-Red to send MQTT data to a SQLite database and Provide data in an organized manner.
My Question, Is their a way to Backup the SQLite database automatically from Node-Red or another way to do it. I'm trying to get away from manually having to do this.
A SQLite db is just a file isn't it? So you can use your normal backup capabilities to do it.
For example, I have some BASH scripts that do daily, weekly, monthly backups of my whole node-red installation. Using links to keep the size to a minimum (and not backing up the node_modules folders which are easily replaced with a npm install). These run on CRON schedules so that I don't have to think about them.
Just copying the file won't work because the database index get corrupted.
I'm using an exec node with the settings as show below. with the sqlite backup command.
This will make a backup of the sqlite database. This will lock the sqlite dbase temporary to make a backup.
You can trigger the exec node (daily) with the trigger node.
The EXEC node is what I'm looking for. So I can back it up in the same directory fine, But can I use this to back it up using a mounted external usb drive.
I tried and the node keeps throwing an error. But backs up perfect within the same folder.
Does the command run in a terminal? If not then it won't run in node-red
If it does run in a terminal then you still haven't told us what the error is. If necessary Look on all the outputs of the exec node with debug nodes configured to show Complete Message.