Need to automatically send a file from a rpi at 3 am to a website
ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
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.
Distribution: openSUSE, Raspbian, Slackware. Previous: MacOS, Red Hat, Coherent, Consensys SVR4.2, Tru64, Solaris
Posts: 2,803
Rep:
Quote:
Originally Posted by pan64
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.
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.
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?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.