This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What files to back up?
#1
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
Reply
#2
looks like a good enough starting point...

https://flows.nodered.org/flow/a275b56b4...8fb2ad2f8a
Reply
#3
node-red flows
openplotter.conf
opencpn.conf
/home/pi/.config/openplotter/imu/settings/RTIMULib.ini (IMU calibration)
kplex.conf
Reply
#4
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 :Cool

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": []
   }
]
Reply
#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.
Reply
#6
(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 Wink

Sent from my SGP511 using Tapatalk
Reply
#7
It was planned a tool to export different config files but it would need to wait for the stable version Smile
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)