Accessing files on a remote machine via FTP (or SAMBA)

#1

I am stuck and would like a bit of help getting an idea into reality.

I want to monitor a remote directory (via FTP or SAMBA) on a remote machine.
If there is a change, it copies the newer/est file to this machine.

fs-io nearly does that but it limited to the local machine.

I am trying to see if there are other ways, the remote machine does allow notifications, but they are via e-mail and stuff I don't have.

After a bit more digging, I found that I can save to a network directory on the remote machine, which then negates the need to monitor the directory via FTP or SAMBA.

(I shouldn't always think too far ahead, as sometimes I ask questions too quickly.)
Sorry folks.

Also I don't mind if I have to poll the directory. That is (at this stage) a given that I would need to if I want to see "changes".

0 Likes

#2

Dependent on what you are running Node-Red on - you could NFS mount the remote directory so that it appears as a local directory and then use the fs-io nodes

Alternatively - run rsync in a tight loop on the machine creating the file and get it to dump newer copies on the node-red host (this would use SSH)

Craig

1 Like

#3

Thanks.

Seems the machine's option to save to remote machine is problematic.

I may have to start again and build the program on top of Raspbian.l

It is annoying when I know I have forgotten more than I can remember.

I used to be better at this remote machine stuff a long time ago.

0 Likes

#4

Yep it moves fast !! What is the remote machine (Operating System etc) - are you in control of it or is it someone elses ?

You running your Node-red on a PI ? Which version, what OS ?

Craig

0 Likes

#5

Can you run node red on the remote machine too? Then you could run some of the processing there and just send back to the local machine whatever it needs, via MQTT possibly.

1 Like

#6

Well......

The "Sending machine" is a RPI Z W with MotionEyeOs installed and running.
I have since found there is a version I can install on top of Raspbian.

But as is:
That is the Sending machine.

The Receiving machine is a RPI 2.
I have just installed the Node-red-ftp-server node. But that isn't as simple either.

Side question: FTP is port 22 - from what I see.
That node uses 7021. ??!! Why? - rhetorical, kinda.

So I get that node configured (on the Receiving machine) and set a username and password.

Go to the motionEyeOs machine and set up the "save to remote machine" then set up the values as per what I put in the node.
"Test FTP" Fails.

So I am stuck knowing if it is the MotionEyeOs not seeing it, or the receiving machine not "allowing" it to connect.

I did a command (Can't remember the exact command: netstat -an | grep 7021 ?) and it is there.
But it is not shown as FTP. It is shown as.... HTTP - Dunno. that terminal is now closed.

I may have to cut my losses and install it over Raspbian and see what happens.

0 Likes

#7

You have 2 ports for FTP - the Control port and the data port. 22 is not FTP that is SSH, 21 is typically used.

I would get away from FTP unless that is inbuilt to the MotionEyeOs and use Rsycn running from the Node-Red machine

here is a discussion about it

0 Likes

#8

Yeah,

But reading that link, I see it as needing to be installed OVER raspbian. Not the cut down version I am running which is a kind of "all in one" thing.

I would like to use the NR CameraPi but it doesn't (didn't) have motion detection, so I looked at this.

I am still not confident enough to try and work my way through getting Rsync installed on the system as is, as that thread goes on to say there are other libraries needed and a bit of installing needed first.

I shall have to maybe put in the time to build another Raspbian and go through the motions of installing the MotionEye thing on top of that.

Fun fun fun. :wink:

0 Likes

#9

Even lite versions of Linux OS's will generally have SSH and RSYNC available? If so, that's almost certainly the easiest way. Change the file locally, give a delay to allow the file to be fully written and closed then sync to the remote. You could pull instead but there is a small risk you might pull an incomplete update which might be corrupt.

0 Likes

#10

the MotionEyeOS while custom is still Linux... and can run ssh etc

0 Likes

#11

Thanks.

Yeah, I decided to cut the losses and install it on an existing Raspbian.
Though I have for errors while doing that, I think that in the longer term it may be better for me to do the harder work now and have a lot more options in the future.

I have got the SSH working (or did get?) on the cut down version, but the sever lack of commands was too daunting for me.
I can't remember what they were, but it only frustrated me more so as I said: I took the bullet and started with a full Raspbian.

0 Likes

#12

That thread i posted says in the last post that the binaries had been added into the kernel on MotionEyeOs ?

Craig

0 Likes

#13

Have you tried node-red-contrib-smb already?

0 Likes

#14

I can guess what you are trying to do is get images or video clips from the motioneyeOS. May I suggest you take a look at how I did it and use node-red-contrib-ftp-server to grab the files from motioneyeOS and then do what you will with them on the local machine: security DVR add-on

I've found that motioneye on top of Raspbian on a a PiZero-W was too sluggish for my purposes, but its an option on Pi2 B or better.

Note there are at least 7 nodes in the "ftp search" node-red-contrib-ftp-server is the one that "just works" to implement a server that motioneyeOS can push the files to.

0 Likes

#15

Hi machagotiago,how to use node-red-contrib-smb get file in node-red? can you help me? pls

0 Likes

#16

Not really an answer to the question as asked, but my solution for a similar problem is that I run a script on the remote machine to watch the directory. If it finds a file it sends and mqtt message with the filename. Node-red than fetches the file (in my case using an sftp mount).

1 Like

#17

Have you tried using the smb node? If yes which problem you had?

0 Likes

#18

Well, I'll bite :slight_smile:

All I can get out of it is "SMB not configuration".

There is no information at all on the node's "home page". Whomever took the trouble of creating it would do well to provide the usual config options and provide examples.

In addition, if the creator is watching, I found this in the node-red-log:
'TypeError: Cannot read property 'split' of null'

0 Likes

#19

Yes, you are right, the README file is missing. We will add that for this node as soon as possible, for sure it will make it easier to configure once you have some examples.
Regarding your issue, would you mind to post here your environment, and also your configuration?

Thanks!

0 Likes

#20

Standard install on a RPi Zero.
Node-RED version: v0.20.3
[info] Node.js version: v8.11.4
[info] Linux 4.14.98+ arm LE

0 Likes