LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 04-01-2014, 03:46 AM   #1
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,153
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
how to tranfer file @ boot via ftp on raspbian?


Hello,
I installed a camera on my raspberry pi.
It takes pictures via "motion" and avi files are created inn /home/pi/motion/video . you can find a good HowTo here http://jankarres.de/2013/12/raspberr...tion-tracking/
At each boot, I would like to tranfer all video files existing in that pi directory to /ftp://fritz.box/USBStickStorage/videofiles (fritz.box is my home router where an usb stick is attached) and delete them from the pi as soon the tranfer is successfully done. Has somebody any suggestion how to do it?
Attention: at boot, it takes approx 2 minutes before the raspberry pi is connecting to the home network via wifi; so, the copy/delete mechanism should not act immediatly at boot but wait till the raspberry is connected to the home network.
The next step could be: any new video should be copied to the home network then deleted if the copy was successfull.
 
Old 04-02-2014, 03:47 PM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Hi, any particular reason you need to do this at bootup? Would a regular cron job make more sense? Sending and deleting files every 10 minutes or so?

Your script could check and ping your router and if it's available then do the actual FTP.

Have you written the script that does the transfer yet?
 
Old 04-02-2014, 06:27 PM   #3
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
I take it Fritz doesn't provide SSH access? If it does, use rsync

Assuming it does not...

ncftpput is an ftp batch utility for sending batch files. When the result code indicates no error, you can delete the local file.

Another utility, weex, is doing something like sync-over-ftp. It is very configurable and can delete source files IIRC.

Furthermore, I agree with TenTenths. Just build a cron job which periodically syncs the files. Then you can skip the complete copy-at-boot problem. The cron job just copies when it can.

jlinkels
 
1 members found this post helpful.
Old 04-02-2014, 07:03 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

Rep: Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624Reputation: 3624
I'd assume that any normal boot time script setting would transfer the files.

Sometimes you have to cheat ftp since it doesn't like scripts. Use expect or autoexpect to create the transfer script.
 
Old 04-02-2014, 07:31 PM   #5
jlinkels
LQ Guru
 
Registered: Oct 2003
Location: Bonaire, Leeuwarden
Distribution: Debian /Jessie/Stretch/Sid, Linux Mint DE
Posts: 5,195

Rep: Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043Reputation: 1043
Why would you prefer ftp+expect over ncftpput? The latter was designed for batch operation.

jlinkels
 
Old 04-04-2014, 05:42 PM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,399
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
rsync is your friend. Efficient, fast, easy.
 
Old 04-07-2014, 03:12 AM   #7
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6 / 7
Posts: 3,475

Rep: Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553Reputation: 1553
Quote:
Originally Posted by theNbomr View Post
rsync is your friend. Efficient, fast, easy.
As mentioned by the OP, his target device is a USB device attached to his router. A quick look at the documentation for a fritz.box would indicate that access to the storage is by FTP or "Media Server uPnP" only.
 
Old 04-12-2014, 10:48 AM   #8
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,153

Original Poster
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
After having a look at each proposal (thanks!), I tried successfull following command few minutes ago

Quote:
ncftpput -DD -d /home/pi/motion/ncftp.log fritz.box /SanDisk-Cruzer-01/video/ /home/pi/motion/video/*
All file were transfered from my raspberry pi to the usb storage which is on my fritz.box router; alle files on the raspberry pi are deleted for more space.
Now, I will put that command in a cron job doing it every 2minutes; I will have a look for advice in the internet how to do it (I never used cron).
 
Old 04-12-2014, 12:05 PM   #9
schneidz
LQ Guru
 
Registered: May 2005
Location: boston, usa
Distribution: fedora-35
Posts: 5,313

Rep: Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918Reputation: 918
this is what i do for my xbmc machine:
Code:
schneidz@xbmc:~$ tail .profile 
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

#/home/schneidz/bin/masq.ksh &
(sleep 45 && /usr/bin/sshfs schneidz@mom:media/stuff hyper) &> /dev/null &
you can probably put the same in /etc/rc.local or add an @reboot entry in the users crontab.
 
Old 04-16-2014, 12:49 PM   #10
floppy_stuttgart
Senior Member
 
Registered: Nov 2010
Location: EU mainland
Distribution: Debian like
Posts: 1,153

Original Poster
Blog Entries: 5

Rep: Reputation: 107Reputation: 107
So, I made
Quote:
crontab -e
and include the line
Quote:
*/2 * * * * /usr/bin/ncftpput -DD -u pi -p mypasswordinraspberry fritz.box /SanDisk-Cruzer-01/video/ /home/pi/motion/video/*
now it runs!
see http://superuser.com/questions/10741...s-with-crontab

Last edited by floppy_stuttgart; 04-16-2014 at 01:20 PM.
 
  


Reply

Tags
camera, ftp, motion, raspbian, videocam



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
boot cd tranfer boot to usb device?? mutsu Linux - General 0 08-17-2006 12:45 PM
problems with file tranfer on kmess Michael_aust Linux - Software 0 06-03-2006 05:20 PM
Very slow file tranfer with kopete martinr Linux - Software 4 04-25-2006 05:20 PM
File Tranfer Without Login Server seattledaze Linux - Newbie 3 08-03-2004 12:56 PM
How to make file tranfer? seattledaze Linux - Networking 1 08-03-2004 06:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 07:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration