Posts: 1,199
Threads: 101
Joined: Mar 2016
Reputation:
71
I'm in the process of setting up a node red flow to auto backup various files once a day - but which ones?
Will probably set up a dedicated openplotter dropbox to save them to.
So far - sudo cp -R /home/pi/.node-red/*.*
/home/pi/.opencpn/
Think I'll add kplex as well and openplotter.conf.
So if I need to reinstall the sd card image from a backup, what other files would save too much setting up again if the backup image wasn't as up to date as it should be..?
Ta
Posts: 1,199
Threads: 101
Joined: Mar 2016
Reputation:
71
Posts: 2,893
Threads: 59
Joined: Mar 2016
Reputation:
278
node-red flows
openplotter.conf
opencpn.conf
/home/pi/.config/openplotter/imu/settings/RTIMULib.ini (IMU calibration)
kplex.conf
Posts: 1,199
Threads: 101
Joined: Mar 2016
Reputation:
71
Thanks. Here's a little node-red flow which backs up into /home/pi/files/backups
The files/backups directories need to exist for it to work.
Saves kplex.conf , all the files in .node-red, files and directories in .opencpn (so the logbook gets backed up, bit big this one so might need some trimming) & openplotter.conf .
Hope this might be useful, any tips / ideas for improvement please share :
Code: [
{
"id": "ff37e71a.cfd4d8",
"type": "exec",
"z": "dcf0a43.0c79158",
"command": "sudo tar ",
"addpay": true,
"append": "",
"useSpawn": "",
"timer": "",
"name": "Execute TAR commands",
"x": 690,
"y": 380,
"wires": [
[
"c11fcb83.2333e8"
],
[
"39689011.b3ef7"
],
[
"4daefb29.ce7564",
"1c0fe9ea.bfd196"
]
]
},
{
"id": "7ffc33ee.c11c4c",
"type": "inject",
"z": "dcf0a43.0c79158",
"name": "Trigger Backups",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"x": 260,
"y": 220,
"wires": [
[
"fac9399e.a052b8"
]
]
},
{
"id": "c11fcb83.2333e8",
"type": "debug",
"z": "dcf0a43.0c79158",
"name": "std out",
"active": true,
"console": "false",
"complete": "payload",
"x": 930,
"y": 320,
"wires": []
},
{
"id": "39689011.b3ef7",
"type": "debug",
"z": "dcf0a43.0c79158",
"name": "std error",
"active": true,
"console": "false",
"complete": "payload",
"x": 940,
"y": 360,
"wires": []
},
{
"id": "4daefb29.ce7564",
"type": "debug",
"z": "dcf0a43.0c79158",
"name": "return code",
"active": true,
"console": "false",
"complete": "payload",
"x": 950,
"y": 400,
"wires": []
},
{
"id": "1c0fe9ea.bfd196",
"type": "function",
"z": "dcf0a43.0c79158",
"name": "Detect Error",
"func": "if (msg.payload==\"Error\") {\n var returnMsg={topic: \"Error in nightly TAR backups\", payload:\"Error in nightly TAR backup operations\"};\n return (returnMsg);\n } else {\n return (null);\n }\n \nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 690,
"y": 440,
"wires": [
[
"b19def16.af5c1"
]
]
},
{
"id": "fac9399e.a052b8",
"type": "function",
"z": "dcf0a43.0c79158",
"name": "Generate TAR commands",
"func": "var today = new Date();\nvar day = today.getDate();\nvar month = today.getMonth();\nvar year = today.getFullYear();\n\n\nvar filestamp= day +'-' + month + '-' + year;\n\n//Node-red backup Backup\nvar returnMsg1={payload: \"-zcvf /home/pi/files/backups/noderedbackup-\" + filestamp + \".tar.gz /home/pi/.node-red/*.*\"};\n\n//opencpn Backup\nvar returnMsg2={payload: \"-zcvf /home/pi/files/backups/OcpnBackup-\" + filestamp + \".tar.gz /home/pi/.opencpn/\"};\n\n//Openplotter Config Backup\nvar returnMsg3={payload: \"-zcvf /home/pi/files/backups/OpenP.confBackup-\" + filestamp + \".tar.gz /home/pi/.config/openplotter/openplotter.conf\"};\n\n//kplex Backup\nvar returnMsg4={payload: \"-zcvf /home/pi/files/backups/KplexBackup-\" + filestamp +\".tar.gz /home/pi/.kplex.conf\"};\n\n//Kick off the TAR commands!\nreturn [returnMsg1, returnMsg2, returnMsg3, returnMsg4];\n\n\n",
"outputs": "4",
"noerr": 0,
"x": 560,
"y": 220,
"wires": [
[
"ff37e71a.cfd4d8"
],
[
"ff37e71a.cfd4d8"
],
[
"ff37e71a.cfd4d8"
],
[
"ff37e71a.cfd4d8"
]
]
},
{
"id": "b19def16.af5c1",
"type": "debug",
"z": "dcf0a43.0c79158",
"name": "",
"active": false,
"console": "false",
"complete": "false",
"x": 950,
"y": 440,
"wires": []
}
]
Posts: 287
Threads: 44
Joined: Mar 2016
Reputation:
5
is a backup to the same SD card really useful? Maybe this flow should be extended to backup to e.g. dropbox or similar.
Posts: 1,199
Threads: 101
Joined: Mar 2016
Reputation:
71
2017-06-08, 02:48 PM
(This post was last modified: 2017-06-08, 02:49 PM by PaddyB.)
(2017-06-08, 02:40 PM)SkipperEarly Wrote: is a backup to the same SD card really useful? Maybe this flow should be extended to backup to e.g. dropbox or similar.
Probably will set up a dedicated small Dropbox at some point, or maybe get ftp working. Though I've never trashed a card so bad that you couldn't net at the files..... Yet anyway
Sent from my SGP511 using Tapatalk
Posts: 2,893
Threads: 59
Joined: Mar 2016
Reputation:
278
It was planned a tool to export different config files but it would need to wait for the stable version
|