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?
#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


Messages In This Thread
What files to back up? - by PaddyB - 2017-06-05, 10:55 AM
RE: What files to back up? - by PaddyB - 2017-06-05, 12:18 PM
RE: What files to back up? - by Sailoog - 2017-06-06, 06:17 PM
RE: What files to back up? - by PaddyB - 2017-06-08, 09:07 AM
RE: What files to back up? - by SkipperEarly - 2017-06-08, 02:40 PM
RE: What files to back up? - by PaddyB - 2017-06-08, 02:48 PM
RE: What files to back up? - by Sailoog - 2017-06-09, 05:38 PM

Forum Jump:


Users browsing this thread: 3 Guest(s)