On Thu, 10 Sep 2020 17:22:55 +0100, NY wrote:
> Yes the only bit I haven't cracked is running a process on the Pi that
> uploads data to the web server (maybe in daily batches, maybe every 10
> minutes when a new entry is added to the local log file on the Pi) so as
> to add it to the SQL table.
>
That sounds like a case for using a cron job. See "man cron" for how to
manage crond, the cron daemon, and "man 5 crontab" for how to write a cron
job script.
crond is a daemon process (i.e. started on boot and waits for stuff to
do) that looks for shell scripts to execute, runs any that it finds, and
e-mails results and/or errors to the user who submitted the job.
Cron jobs can be run once every hour, day, week or month by putting a
script in the appropriate directory, e.g scripts in /etc/cron.daily are
run once a day, typically somewhat after midnight. In these cases the
script contains details of which user it should be run under and where to
send any data written to stdout or stderr, with the default being to run
it under root and to send output to root.
Jobs with more complex or frequent run timing requirements are put in
/etc/cron.d and contain one or more lines, each defining what to run and
when. Here's one of mine:
=====================================================================
#
# getmail is run every 10 minutes
# ===============================
# Results are sent to root
#
SHELL=/bin/bash
MAILTO=root
1,11,21,31,41,51 0-23 * * * root /usr/local/bin/getmail.cronscript
=====================================================================
This uses /bin/bash to run the /usr/local/bin/getmail.cronscript shell
script under the root user and e-mails any output, which would be error
reports, to 'root'. It is run every 10 minutes at 1,11.23.31.41 and 51
minutes after the hour.
--
Martin | martin at
Gregorie | gregorie dot org
--- SoupGate-Win32 v1.05
* Origin: Agency HUB, Dunedin - New Zealand | FidoUsenet Gateway (3:770/3)
|