ftp causing invalid syntax

No, mount works on many other types of devices and virtual filing systems. It can also mount anywhere within the filing system hierarchy, but it never creates any directories. The place where you mount something has to be an existing directory, which is then overlaid by whatever you are mounting.

---druck

Reply to
druck
Loading thread data ...

Yes it was quite some time ago now, as I could not get emby media player to see my music files. After I included the said line, emby now sees my music

Reply to
RobH

You still don't get it.

^^^^^^^^^^^^^

you try to save the file on the NAS's filesystem, when you should save it on the PI's filesystem.

mount = make a link from a point in one machine's filesystem to point on ANOTHER machine's filesystem

if you did the mount - like I said before - you would save it to /mnt/nas ON THE PI. And it would end up on your NAS

given mount .... //192.168.0.22/mnt/CCTV/PiZero /mnt/nas

the filename in the python script should be '/mnt/nas/2018-16-16_11.25.36.h264'

--
--
Reply to
Björn Lundin

Yeah, I was thinking about the initial partition mount. IIRC the directories in the root partition are created from /etc/fstab during the initial mount, because for sure they aren't set up by partition formatting, but I may have misremembered how fstab processing works.

Apart from that my other mounts, e.g. for backups, were scripted years ago and have not been looked at since ... the brain gets rusty.

--
Martin    | martin at 
Gregorie  | gregorie dot org
Reply to
Martin Gregorie

On Thu, 17 May 2018 19:57:50 +0100, RobH declaimed the following:

You are logged into the NAS... That is not the machine you need to do the mount on.

CCTV is a LOCAL DIRECTORY ON THE NAS...

You have to create a directory on the RPI which you use "mount" on in order to link the NAS directory onto the RPI directory (the names do not have to be the same).

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

Traceback (most recent call last) File "intruder_recmotion.py", line 37, in shutil.copyfile(RAMname, NASname) File "/usr/lib/python 2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 2] No such file or directory: '/192.168.0.22/mnt/CCTV/PiZero/2018-16-16_11.25.36.h264'

I have checked the path to the PiZero folder or dataset on my FreeNAS box and it is correct.

I am not doing the mount on my NAS box, only on the Pi Zero.

And I am not sure if you saw my reply to you after you supplied the new python code for me to use, but I am getting this when I run the said script.

After I created the the said folders on the Pi Zero ie /mnt/CCTV/PiZero I then ran the python script for the sensor detection and camera , and it returned :

Traceback (most recent call last) File "intruder_recmotion.py", line 37, in shutil.copyfile(RAMname, NASname) File "/usr/lib/python 2.7/shutil.py", line 83, in copyfile with open(dst, 'wb') as fdst: IOError: [Errno 2] No such file or directory: '/192.168.0.22/mnt/CCTV/PiZero/2018-16-16_11.25.36.h264'

I have checked the path to the PiZero folder or dataset on my FreeNAS box and it is correct.

You're not storing the result of join. This should be something like:

for f in os.listdir(src_dir): f = os.path.join(src_dir, f)

For me, as I am only a newbie wit both Linux and more so python, I am not sure where I would actually include a similar statement or line of code in the python code you did for me.

Reply to
RobH

Perfect - and you have also mounted the NAS directory onto this ? If not then do so.

Remove the /192.168.0.22 bit - the directory is /mnt/CCTV/PiZero not /192.168.0.22/mnt/CCTV/PiZero.

--
Steve O'Hara-Smith                          |   Directable Mirror Arrays 
C:\>WIN                                     | A better way to focus the sun 
 Click to see the full signature
Reply to
Ahem A Rivet's Shot

As someone else said before, the path to copy to as given in the script should not contain the NAS IP-address.

Change /192.168.0.22/mnt/CCTV/PiZero to /mnt/CCTV/PiZero

--
Kees Nuyt
Reply to
Kees Nuyt

Theme of the thread.

Reply to
A. Dumas

Ok I have removed the //192.168.0.22 and is now //mnt/CCTV/PiZero.

The python script runs without error, BUT it does not record any file from detected motion.At least, I cannot find any files in //mnt/CCTV/PiZero on the PI Zero, nor on my NAS box.

You say to 'mount the NAS directory into this'

Where abouts in the //mnt/CCTV/PiZero does it go.

Thanks

Reply to
RobH

NO,NO,NO The // in the begining signifies a machine. The file should be save into the directory /mnt/CCTV/PiZero

NO // in the beginning just a single /

As I stated several times before.

on the PI: sudo mount .... //192.168.0.22/some/directory /mnt/CCTV/PiZero

This means that the contents of *remote directory* - that is on the NAS is accessible from *local directory* /mnt/CCTV/PiZero

in your script ON THE PI, save to *local directory* /mnt/CCTV/PiZero and the file will show up on the *remote directory* on the nas.

It would help alot if you

  • copied the output from the commands - not just type them into the newsreader
  • stated on which machine you are
  • showed the python code
--
--
Reply to
Björn Lundin

I am getting permission denied when I try to save the python script to /mnt/CCTV/PiZero. How can I use sudo to do that.

Reply to
RobH

On Fri, 18 May 2018 12:47:24 +0100, RobH declaimed the following:

Remove the extra / -- the local machine file system root is just one /

It doesn't go "in" the directory...

The "mount" command takes the NAS path (this is the one that has the IP#) and maps it to the local directory path (the one without an IP#) by which you will access it. They don't have to be the same names. It just requires the local directory path to exist first.

mount ... //NAS/mnt/CCTV/PiZero /mnt/CCTV/PiZero

maps the local PiZero directory to the NAS PiZero directory -- but leaves the parent CCTV directory as a local:

cd /mnt/CCTV is still on the RPI cd /mnt/CCTV/PiZero is really on the NAS

but if you did

mount ... //NAS/mnt/CCTV /mnt/CCTV

and the NAS has the full path to a PiZero directory then

cd /mnt/CCTV will be on the NAS, and cd /mnt/CCTV/PiZero will also be on the NAS

"mount" sets the "root" for the remote file system -- you can go /down/ deeper in the directory structure, but can not go above the remote root (attempts will put you back in the local RPI file system)

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

Thanks for the clarification there, much appreciated.

On the PiZero I did mount //NAS/mnt/CCTV/PiZero /mntCCTV/PiZero and it returned: Password for root@N/NAS/mnt/CCTV/PiZero. So I used the PiZero password as I didn't know what else to use.

And then it returned: mount error(115): operation now in progress. Refer to mount.cifs(8) manual page

Also I did mount //NAS/CCTV /mnt/CCTV, and this also returned the same as above

Reply to
RobH

If it's not a troll then it's the perfect script for a trolling session.

Cynical? Indeed I am.

Reply to
mm0fmf

On Fri, 18 May 2018 16:53:18 +0100, RobH declaimed the following:

Why are you trying to put the /script/ there?

Remember -- I don't have a real NAS, so I'm using a variation of "mount" to redirect part of the file system itself to a mount point.

pi@raspberrypi:~$ ls Desktop Downloads oldconffiles Public Templates Documents Music Pictures python_games Videos pi@raspberrypi:~$ ls Public

Nothing in the "Public" directory... so create a directory tree within it... This is supposed to be the NAS directory tree (what you would find if you logged into the NAS itself).

pi@raspberrypi:~$ mkdir Public/myFakeNAS pi@raspberrypi:~$ mkdir Public/myFakeNAS/aSubDir

pi@raspberrypi:~$ ls /media pi

Just some old stuff in /media... Create the "mount point" directory -- this is the location on the RPI where you will mount the NAS -- note that the path name does not have be a duplicate of the one on the NAS itself

pi@raspberrypi:~$ sudo mkdir /media/FakeNASmnt

"mount" the "NAS" onto the mount point I created. "--bind" is an option that allows for source to be a file system rather than a block/network device (this is all on one line). Also note that I mounted a higher level, not the bottom-most directory.

pi@raspberrypi:~$ sudo mount --bind /home/pi/Public/myFakeNAS/ /media/FakeNASmnt/

Show the contents of the /media/FakeNASmnt directory -- note how the subdirectory I'd created in Public/myFakeNAS is there...

pi@raspberrypi:~$ ls -R /media/FakeNASmnt/ /media/FakeNASmnt/: aSubDir

/media/FakeNASmnt/aSubDir:

Create a file in the "NAS" mount point subdirectory

pi@raspberrypi:~$ vim /media/FakeNASmnt/aSubDir/aNewFile.txt pi@raspberrypi:~$

Show the file in the mount point

pi@raspberrypi:~$ ls -R /media/FakeNASmnt/ /media/FakeNASmnt/: aSubDir

/media/FakeNASmnt/aSubDir: aNewFile.txt

Copy the file up one level (which is still the faked NAS)

pi@raspberrypi:~$ cp /media/FakeNASmnt/aSubDir/aNewFile.txt /media/FakeNASmnt/aCopy.dat

Show results of the copy in the mount point

pi@raspberrypi:~$ ls -R /media/FakeNASmnt/ /media/FakeNASmnt/: aCopy.dat aSubDir

/media/FakeNASmnt/aSubDir: aNewFile.txt pi@raspberrypi:~$

Show the contents of the real "NAS"

pi@raspberrypi:~$ ls -R Public/myFakeNAS/ Public/myFakeNAS/: aCopy.dat aSubDir

Public/myFakeNAS/aSubDir: aNewFile.txt pi@raspberrypi:~$

Unmount the "NAS"

pi@raspberrypi:~$ sudo umount /media/FakeNASmnt

The mount point is back to an empty directory...

pi@raspberrypi:~$ ls -R /media/FakeNASmnt/ /media/FakeNASmnt/:

... but the files are still in what would have been the NAS if I had one...

pi@raspberrypi:~$ ls -R Public/myFakeNAS/ Public/myFakeNAS/: aCopy.dat aSubDir

Public/myFakeNAS/aSubDir: aNewFile.txt pi@raspberrypi:~$

In effect -- the "ls" and "mkdir" statements with "Public" in the path are something done while logged into the NAS. (remote machine)

Statements with "/media" are what one does logged into the R-Pi (local machine)

The mount statement is done ON the local machine and "/home/pi" is filling in for the "IP#" of the remote machine

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

On Fri, 18 May 2018 18:07:11 +0100, RobH declaimed the following:

Since you tend to be typing everything in these posts rather than cut&pasting directly from the RPI console window it is difficult to tell what may or may not be a typo...

It wants the password for the root account on the NAS... As it said: root@N/NAS/mnt/CCTV/PiZero

formatting link

You need to pass username and password options to the mount command (especially if the NAS login is not the same as the R-PI user).

You probably also need to "umount" these to clean up partial operations.

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
	wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

1 - you should save your *picture* there, *not* the scrip 2 - ls -la /mnt/CCTV/PiZero gives you that root owns it fix by making pi the owner

sudo chown -R pi:pi /mnt/CCTV/PiZero

then try

echo "test" > /mnt/CCTV/PiZero/test.txt

and see if it turns up at the NAS. but mount the NAS first.

--
--
Reply to
Björn Lundin

Because another poster told me to do that: This is what I was told:

That is what I have right now: //mnt/CCTV/PiZero, in the python script

When I do that mkdir Public/myFakeNAS it returns mkdir: cannot create directory 'Public/myFakeNAS': no such file or directory

>
Reply to
RobH

where the *script* resides does not matter. I said *in* your script ON THE PI, save to *local directory* This is - of course - about the file you wanh't on then NAS - the picture.

so - save the *picture* (which you do *in your script*) to the local directory.

--
--
Reply to
Björn Lundin

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.