On Thu, 10 Sep 2020 20:38:41 +0100, NY wrote:
> Yes I'd already identified that cron would be a good way of triggering
> the upload. It's a matter of working out what can be run (via cron) at
> the Pi which makes a remote web server add data to an SQL database held
> on its server, preferably searching for each row of data that is about
> to be added to check that it doesn't already have it - to make the
> process resilient to temporary outages which would otherwise cause it to
> miss data if there was no catchup mechanism.
>
What, if any, control will you have over the format of data in the email?
I did something similar recently, and ended up using a web page and a bit
of PHP to capture data from the user, which made parsing the message body
trivial. Then I modified my mail system so that all mail sent by the web
page ends up in a dedicated user. Its picked up from that user's mail
queue by an overnight cronjob running a chunk of Java that reads the
messages (using the javax.mail classes) and processes them. This doesn't
use a database, but I know that the JDBC classes work well with
PostgreSQL and, of course, there's also the Derby DBMS which interfaces
directly with Java applications because its written in Java.
> I'll probably write the query-and-display software first, manually
> uploading each month's data into the SQL table, and leave the automatic
> cron-driven uploading with resilience until later.
>
If you're unfamiliar with awk, that may be worth a look: its a script
language designed for analysing and extracting information from plain
text.
--
Martin | martin at
Gregorie | gregorie dot org
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|