LinuxQuestions.org
Visit Jeremy's Blog.
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, 04:46 AM   #1
floppy_stuttgart
Member
 
Registered: Nov 2010
Location: Stuttgart, Germany
Distribution: Tiny Core Linux 4.5.6, knoppix 6.7, antixM8.11, partedmagic, slitaz 3.0,PuppyLinux,Ubuntu 10.04
Posts: 578
Blog Entries: 2

Rep: Reputation: 39
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, 04:47 PM   #2
TenTenths
Senior Member
 
Registered: Aug 2011
Location: Dublin
Distribution: Centos 5 / 6
Posts: 1,678

Rep: Reputation: 529Reputation: 529Reputation: 529Reputation: 529Reputation: 529Reputation: 529
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, 07:27 PM   #3
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,319

Rep: Reputation: 594Reputation: 594Reputation: 594Reputation: 594Reputation: 594Reputation: 594
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, 08:03 PM   #4
jefro
Guru
 
Registered: Mar 2008
Posts: 12,341

Rep: Reputation: 1564Reputation: 1564Reputation: 1564Reputation: 1564Reputation: 1564Reputation: 1564Reputation: 1564Reputation: 1564Reputation: 1564Reputation: 1564Reputation: 1564
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, 08:31 PM   #5
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Wheezy/Jessie/Sid, Linux Mint DE
Posts: 4,319

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

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

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

Rep: Reputation: 529Reputation: 529Reputation: 529Reputation: 529Reputation: 529Reputation: 529
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, 11:48 AM   #8
floppy_stuttgart
Member
 
Registered: Nov 2010
Location: Stuttgart, Germany
Distribution: Tiny Core Linux 4.5.6, knoppix 6.7, antixM8.11, partedmagic, slitaz 3.0,PuppyLinux,Ubuntu 10.04
Posts: 578
Blog Entries: 2

Original Poster
Rep: Reputation: 39
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, 01:05 PM   #9
schneidz
Senior Member
 
Registered: May 2005
Location: boston, usa
Distribution: fc-15/ fc-20-live-usb/ aix
Posts: 4,354

Rep: Reputation: 676Reputation: 676Reputation: 676Reputation: 676Reputation: 676Reputation: 676
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, 01:49 PM   #10
floppy_stuttgart
Member
 
Registered: Nov 2010
Location: Stuttgart, Germany
Distribution: Tiny Core Linux 4.5.6, knoppix 6.7, antixM8.11, partedmagic, slitaz 3.0,PuppyLinux,Ubuntu 10.04
Posts: 578
Blog Entries: 2

Original Poster
Rep: Reputation: 39
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 02:20 PM.
 
  


Reply

Tags
camera, ftp, motion, raspbian, videocam


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 01:45 PM
problems with file tranfer on kmess Michael_aust Linux - Software 0 06-03-2006 06:20 PM
Very slow file tranfer with kopete martinr Linux - Software 4 04-25-2006 06:20 PM
File Tranfer Without Login Server seattledaze Linux - Newbie 3 08-03-2004 01:56 PM
How to make file tranfer? seattledaze Linux - Networking 1 08-03-2004 07:26 AM


All times are GMT -5. The time now is 07:43 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration