File Copy in Node Red (HA Monitoring)

I am trying to copy the ‘home-assistant.log’ file to another file called ‘home-assistant-crash.log’ using node-red-contrib-fs-ops or this way Node-red automations on Github? link has many flows I have done the HA monitoring flow.

My HA and Node Red are in Dockers. (NOT Hassio)

The problem I am having is the file path is not correct. It keeps given me errors. i have made the
‘home-assistant-crash.log’ file with all permissions 777.

Any help please.:worried:


[{“id”:“488fe704.e55ae8”,“type”:“delay”,“z”:“abe78a12.9b7918”,“name”:"",“pauseType”:“delay”,“timeout”:“10”,“timeoutUnits”:“seconds”,“rate”:“1”,“nbRateUnits”:“1”,“rateUnits”:“second”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:false,“x”:820,“y”:1440,“wires”:[[“dbf89879.5fdb18”]]},{“id”:“1db9c2b8.76a5ad”,“type”:“delay”,“z”:“abe78a12.9b7918”,“name”:"",“pauseType”:“rate”,“timeout”:“5”,“timeoutUnits”:“seconds”,“rate”:“1”,“nbRateUnits”:“10”,“rateUnits”:“minute”,“randomFirst”:“1”,“randomLast”:“5”,“randomUnits”:“seconds”,“drop”:true,“x”:360,“y”:1440,“wires”:[[“488fe704.e55ae8”,“e652e0db.627f6”]]},{“id”:“4746a81.6c2dd58”,“type”:“rbe”,“z”:“abe78a12.9b7918”,“name”:"",“func”:“rbe”,“gap”:"",“start”:"",“inout”:“out”,“property”:“payload”,“x”:190,“y”:1440,“wires”:[[“1db9c2b8.76a5ad”]]},{“id”:“9340e315.874ea”,“type”:“change”,“z”:“abe78a12.9b7918”,“name”:“Format message”,“rules”:[{“pt”:“msg”,“to”:“Can’t reach port 8123 on local host for Home Assistant. Restarting Home Assistant. “,“p”:“payload”,“t”:“set”,“tot”:“str”},{“tot”:“str”,“t”:“set”,“p”:“topic”,“pt”:“msg”,“to”:“Home Assistant Port not reachable”}],“action”:””,“property”:"",“from”:"",“to”:"",“reg”:false,“x”:210,“y”:1360,“wires”:[[“4746a81.6c2dd58”]]},{“id”:“b8ebc260.05152”,“type”:“switch”,“z”:“abe78a12.9b7918”,“name”:“Continue after 5 errors”,“property”:“count”,“propertyType”:“msg”,“rules”:[{“t”:“lte”,“vt”:“num”,“v”:“5”},{“v”:“5”,“vt”:“num”,“t”:“gt”}],“checkall”:“true”,“repair”:false,“outputs”:2,“x”:780,“y”:1160,“wires”:[[],[“9340e315.874ea”,“d6ae5e2b.9232c”]]},{“id”:“aefc270a.ff2b48”,“type”:“counter”,“z”:“abe78a12.9b7918”,“name”:"",“init”:“0”,“step”:“1”,“lower”:null,“upper”:null,“mode”:“increment”,“outputs”:“1”,“x”:590,“y”:1160,“wires”:[[“b8ebc260.05152”]]},{“id”:“10f4240e.b6a0cc”,“type”:“switch”,“z”:“abe78a12.9b7918”,“name”:"",“property”:“payload”,“propertyType”:“msg”,“rules”:[{“v”:“ECONNREFUSED”,“vt”:“str”,“t”:“cont”}],“checkall”:“true”,“repair”:false,“outputs”:1,“x”:420,“y”:1160,“wires”:[[“61836c5d.049084”,“aefc270a.ff2b48”]]},{“id”:“f3a4809b.6614b”,“type”:“http request”,“z”:“abe78a12.9b7918”,“name”:"",“method”:“GET”,“ret”:“txt”,“paytoqs”:false,“url”:“http://192.168.85.5:8123”,“tls”:"",“proxy”:"",“x”:280,“y”:1160,“wires”:[[“10f4240e.b6a0cc”]]},{“id”:“5a045373.4f088c”,“type”:“inject”,“z”:“abe78a12.9b7918”,“name”:"",“topic”:"",“payload”:"",“payloadType”:“date”,“repeat”:“30”,“crontab”:"",“once”:true,“onceDelay”:“60”,“x”:120,“y”:1160,“wires”:[[“f3a4809b.6614b”]]},{“id”:“991e1c61.e4187”,“type”:“comment”,“z”:“abe78a12.9b7918”,“name”:“Monitor the Home Assistant port”,“info”:"",“x”:160,“y”:1120,“wires”:[]},{“id”:“d6ae5e2b.9232c”,“type”:“change”,“z”:“abe78a12.9b7918”,“name”:“Reset counter”,“rules”:[{“pt”:“msg”,“to”:“true”,“p”:“reset”,“t”:“set”,“tot”:“str”}],“action”:"",“property”:"",“from”:"",“to”:"",“reg”:false,“x”:500,“y”:1240,“wires”:[[“aefc270a.ff2b48”]]},{“id”:“61836c5d.049084”,“type”:“debug”,“z”:“abe78a12.9b7918”,“name”:“HTTP Error”,“active”:true,“tosidebar”:true,“console”:true,“tostatus”:false,“complete”:“true”,“x”:270,“y”:1240,“wires”:[]},{“id”:“e4cfab8e.2e31b8”,“type”:“debug”,“z”:“abe78a12.9b7918”,“name”:"",“active”:true,“tosidebar”:true,“console”:false,“tostatus”:false,“complete”:“false”,“x”:1010,“y”:1360,“wires”:[]},{“id”:“dbf89879.5fdb18”,“type”:“http request”,“z”:“abe78a12.9b7918”,“name”:“Hass Restart”,“method”:“POST”,“ret”:“txt”,“paytoqs”:false,“url”:“http://192.168.85.5:8126/container/home-assistant/restart",“tls”:"",“proxy”:"",“x”:1010,“y”:1440,“wires”:[[]]},{“id”:“cd68e34.f5f602”,“type”:“inject”,“z”:“abe78a12.9b7918”,“name”:"",“topic”:"",“payload”:"",“payloadType”:“date”,“repeat”:"",“crontab”:"",“once”:false,“onceDelay”:0.1,“x”:460,“y”:1360,“wires”:[[“e652e0db.627f6”]]},{“id”:“e652e0db.627f6”,“type”:“fs-ops-copy”,“z”:“abe78a12.9b7918”,“name”:"Copy HA Log”,“sourcePath”:"/home/cameron/homeasistant/",“sourcePathType”:“str”,“sourceFilename”:“home-assistant.log”,“sourceFilenameType”:“str”,“destPath”:"/home/cameron/homeasistant/",“destPathType”:“str”,“destFilename”:“home-assistant-crash.log”,“destFilenameType”:“str”,“link”:false,“overwrite”:true,“x”:800,“y”:1360,“wires”:[[“e4cfab8e.2e31b8”]]}]

/home/cameron doesn’t exist INSIDE the container. You need to bind mount a volume to your node-red docker. You can use the same mount/path as the settings/config if this is one file

Thanks for the quick response I am using docker-compose.
So if I do this in my node-red and add in a extra volume. Then my path will be ‘ha_config’?

   volumes:
      - ${USERDIR}/docker/node_red:/data
      - ${USERDIR}/homeassistant:/ha_config
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro

Yeah, you need to mount that home assistant directory so that node-red can see the log file. If you use that bind mount, your path will be /ha_config since that command is telling the container to mount it in the root volume at the path /ha_config

1 Like

That worked perfectly

Thank You.:smiley:

1 Like