LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-02-2020, 05:00 AM   #1
schmitta
Member
 
Registered: May 2011
Location: Blacksburg VA
Distribution: UBUNTU, LXLE
Posts: 352

Rep: Reputation: Disabled
Need to automatically send a file from a rpi at 3 am to a website


I am a newbie at this. I need to daily automatically send a file to either 1) a website or 2) by email of data collected that day on a remote RPi located 300 miles away from my home. Do not know how to do it. Thank you for your help.
 
Old 12-02-2020, 05:41 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,918

Rep: Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318Reputation: 7318
that depends on the configuration and the size of the data too, there are [too] many possibilities.
for example: scp or rsync can be used or you can use a simple web server or ???. Sending a mail can work too.

I would probably try rsync.
 
1 members found this post helpful.
Old 12-02-2020, 06:14 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,736

Rep: Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921Reputation: 5921
1) Depends on website. From the command line you can use curl or wget. If it is your website you should have some ssh capability to upload files via rsync or sftp and using keys makes scripting easier.
If you can directly access the Pi by forwarding a port you can use ssh from you home computer to download the file. Use key only authentication.

2) There are several command line mail clients like mutt where you can send mail with attachments from the command line. Some mail servers require OAUTH2 like gmail which makes configuring mail clients complex if they have that capability.
 
Old 12-02-2020, 08:12 AM   #4
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,661

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by schmitta View Post
I am a newbie at this.
A 'newbie', who has been here nine years, and says their a programmer on their profile??
Quote:
I need to daily automatically send a file to either 1) a website or 2) by email of data collected that day on a remote RPi located 300 miles away from my home. Do not know how to do it. Thank you for your help.
If both are connected to the Internet, you could easily set up a simple SSH job to run via CRON, and use SCP to copy the file. But you don't say anything about how these systems are connected, what they're running on both ends, what kind of data it is, how large it is, etc. Most importantly, you don't show us what you've done/tried so far.

If this is just text data and you know where the file is on the remote system, you can easily grab it with tools like scp or (as mentioned by michaelk) sftp.
 
Old 12-04-2020, 02:58 PM   #5
rnturn
Senior Member
 
Registered: Jan 2003
Location: Illinois (SW Chicago 'burbs)
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803

Rep: Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550Reputation: 550
Quote:
Originally Posted by pan64 View Post
that depends on the configuration and the size of the data too, there are [too] many possibilities.
for example: scp or rsync can be used or you can use a simple web server or ???. Sending a mail can work too.

I would probably try rsync.
Before investing too much in `scp'... there's a move to deprecate that utility within the OpenSSH community. An article about this and a discussion can be found here.

So it seems that `rsync' may be the much better way to go so you don't have to re-engineer a solution at some future date.

Later...
 
1 members found this post helpful.
Old 12-05-2020, 12:23 AM   #6
schmitta
Member
 
Registered: May 2011
Location: Blacksburg VA
Distribution: UBUNTU, LXLE
Posts: 352

Original Poster
Rep: Reputation: Disabled
Thank you for replying to me. The RPI is 300 miles from my home where I need to get the data. if I collect once a second and the data is a character string 80 bytes long it will be 6.912e6 bytes in length. I started in computers in 1968 and I have been doing compilers, real time operating systems and embedded for 48 years probably before you who made the newbie comment was born - no I am not a newbie but I just do not know how to do this in command line Linux.
 
Old 12-05-2020, 12:57 AM   #7
Turbocapitalist
LQ Guru
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 7,328
Blog Entries: 3

Rep: Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726Reputation: 3726
As mentioned, rsync can fetch the file from the remote system. It runs over SSH so you'll need remote access with SSH and that, in its least complicated form, requires having an externally accessible address. Can you SSH from where you are at to the remote Raspberry Pi?
 
Old 12-05-2020, 09:45 AM   #8
sgosnell
Senior Member
 
Registered: Jan 2008
Location: Baja Oklahoma
Distribution: Debian Stable and Unstable
Posts: 1,943

Rep: Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542Reputation: 542
I think I would approach this via sshfs. Once you have the appropriate remote directories mounted as a local filesystem, it's easy enough to manipulate the files as desired. But even ssh can do the job, just a little more complicated for me. But as almost always, there are multiple ways of solving the problem.
 
Old 12-06-2020, 10:07 AM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 26,661

Rep: Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970Reputation: 7970
Quote:
Originally Posted by schmitta View Post
Thank you for replying to me. The RPI is 300 miles from my home where I need to get the data. if I collect once a second and the data is a character string 80 bytes long it will be 6.912e6 bytes in length.
You still haven't told us what version/distro of Linux you're using or anything about what you've done or tried, and have been given several suggestions. Have you pursued any of them yet?? SFTP, SCP, and rsync (which can also run over the SSH port), have all been mentioned, along with curl. For example, putting "automatic rsync over ssh" into Google pulls up, as one of the very first hits:
https://www.techrepublic.com/article...ups-using-ssh/

...a complete how-to, with cron examples, commands to enter, etc.
Quote:
I started in computers in 1968 and I have been doing compilers, real time operating systems and embedded for 48 years probably before you who made the newbie comment was born - no I am not a newbie but I just do not know how to do this in command line Linux.
Sorry, but you were the one who 'made the newbie comment', as you started out in your first post by saying:
Quote:
Originally Posted by schmitta
I am a newbie at this.
...and I merely questioned how someone who has been on this Linux forum for nine years is a 'newbie', especially since you seem to have the abilities needed to set up and configure an RPI, get it hooked to whatever device gathers the data, hook it to the Internet, etc. And if you have been a programmer that long, you certainly should be familiar with reading documentation, which is much easier and more available now than it was in 1968.
 
  


Reply

Tags
rpi crone



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
LXer: GNOME 3.33.2 Released, Krita 4.2 Debuts, RPi Camera Modules on RPi Zeros Power the Penguin Watch Project, Intrinsyc Switches Its Home LXer Syndicated Linux News 0 05-30-2019 06:23 AM
U-Boot for RPi (Need help) jayanidharmesh Linux - Embedded & Single-board computer 11 03-27-2015 12:46 PM
LXer: Mini-PC taps RPi Compute Module and supports RPi 2 LXer Syndicated Linux News 0 02-22-2015 03:03 PM
Want to use my linux box to send to send a mail and attach a file. Need help omicky83 Linux - Newbie 1 10-02-2013 05:00 PM
Postfix : mail cannot send to send outside ( can send/receive locally) bobbinsupport Linux - Networking 3 12-15-2007 10:40 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:31 AM.

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