Automatically upload from NAS

Hello,
is there a possibility that octoprint automatically uploads files from a nas?
I already tried automatically copying the files with a program from the nas to the watched folder, but octoprint doesn't recognized the files in the watched folder.

So my current setup is:

PC(Windows) <-> NAS with Samba(always running; linux) <->octoprint(linux)

so the goal is, to safe files from the pc on the nas which should than automatically be uploaded to octoprint when the laptop with octoprint installed on it ist running.

Is there any possibility to archive this?

Regards
Herbert

Nope. OctoPrint won't do this. There is a watch folder in octoprint that you can drop files into which will cause autoprint to "import" them. You can sync a Windows pc's folder with a linux pc's folder using a tool called WinScp.

So PC => WinSCP => OctoPrint

I do the same. I share the upload folder with my windows pc (cifs samba share). I store the gcode file with the windows PC and the only thing what i have to do is: Press the Refesh File List Button.
image

In your case it should work if you create a share "upload" on your nas... and share it with both. The octoprint server... and with your home pc.

I really do not recommend sharing the upload folder since there's some bookkeeping done on the files therein which you bypass if you modify it outside of the control of OctoPrint.

It should mostly no longer cause issues since I've done a ton of workarounds to make sure this scenario doesn't break people's setup, but still, it's not officially recommended.

2 Likes

@foosel
What is from your view the recommended solution to sync files? If i use cura there is no problem. But S3D doesnt provide any API Interface to Octoprint.

For me i see a controlled folder... watched via script and upload the folder content over the api interface if a file is created or changed..


Christian

This is precisely what the watched folder is supposed to do. Put stuff in there, it will get uploaded through the right internal APIs and all necessary house keeping will be taken care of.

The problem with sharing the watched folder is, that the ocotprint server is not always running, so I would always need to start the octoprint server and than go back to the pc to put the files in the shared folder, wich i would like to avoid.

Unfortunately this is not working. I tried different tool that copied the files from the nas to the watched folder automatically when the octoprint server is running. But Octoprint didn't uploaded them. Octoprint only uploaded them when I manually copied them to the watched folder. Is there a possible fix?

Sorry for my bad english, I hope everything is understandable.

Ah. Okey so i have to change only the shared folder from upload to watched.

I can't possibly tell you without a proper bug report.

You could try playing with the "polling" setting:

I can confirm... there is a problem
If i copy with Windows in the network share... it works.

image

If i copy the file in the via my "sync" programm nextcloud, octoprint will ignore the file.

Active poll is set..
User is also OK

Edit:
Okey... if i change the user to "Christian" it works ... dont understand why but it works.

Note:
user nas = the octoprint user
user christian = samba share user

Then please file a bug report with full reproduction steps so I can look into it. Otherwise the likelihood of it getting lost is sadly very high as I have a ton of stuff on my plate all the time :confused:

You could change your workflow and use the GitFiles plugin, using a github repository as the master and doing change control as you might with software.

It's been a while since I've messed with this, but isn't it possible to just make the folder on your NAS be your watches folder by directing OctoPrint to use that folder as the watched folder?

The watched folder does not have to be on your SD card, does it?

Sure. But i need more time to analyse. The current state is: I perform a server restart and it looks that now from both systems file are accepted. I dont now why.

You could change your workflow and use the GitFiles plugin, using a github repository as the master and doing change control as you might with software.

I will take a look hat this Plugin

That is indeed some odd behaviour.

Good Idea. I tried it and the "test button" says that the path is valid.
However the watched folder is still not working.

okay, I will try to make a bug report.

You allready checked the user und group rights for this folder @Herbert ?

The owner of the folder is root, but everyone can read an write the folder. The gcode files in the folder have the same permisson as the folder.
In my opinion there shouldn't be any problems with the permissions, but I'm not that familiar with linux file structure.

@Herbert
Check the required user with ps. In my case "nas"
Command:

sudo ps -axu | grep Octo

Output:

root      2161  0.0  0.0  15056  1036 pts/1    S+   11:44   0:00 grep --color=auto Octo
nas      10044  3.0  1.7 1455248 143532 ?      S<sl Sep20  35:35 /home/nas/OctoPrint/venv/bin/python2 /home/nas/OctoPrint/venv/bin/octoprint serve

So "nas" is my user witch execute "Octoprint"

Change the folder owner with:
sudo chown nas foldername

root as owner and "everyone" can write and read sounds wrong :slight_smile:

I checked and tweaked the ownership of the files:
file owner on the nas:

Result: The user that is running Octo is Herbert.

Checking the new ownership of the files in the folder on the nas:

-rwx------ 1 Herbert Herbert 0 Sep 21 13:09 test3.gcode

but the problem is remaining :frowning_face: