Easy way to have each Pi send me a daily system status report?

G'day.

I wonder what is the easiest way from the command line (as I run some of my Pi's without a GUI) to have a Pi send me a daily system status report?

I don't need anything detailed. Just the equivalent of a snapshot of 'top -o %CPU' emailed/tweeted/or in some way communicated to me, so I'll notice it from my desktop or mobile devices.

I know how to use cron. I'm just not sure how to generate and send the report without a lot of hassle and configuration, like setting up an email sever. My Unix command line-fu is very weak after a couple decades on GUI OSes.

Any and all wisdom bestowed upon me is appreciated :-)

Regards, Jamie Kahn Genet

--
If you're not part of the solution, you're part of the precipitate.
Reply to
Jamie Kahn Genet
Loading thread data ...

One way is to write the report to stdout and let crontab send it to you: crond defaults to sending anything written to stdout or stderr to the user the cron job is running under, but by setting the MAILTO variable in the controlling crontab you can override that and send the report to any valid user on the RPi.

See "man 5 crontab" and look at the MAILTO variable.

I think that crond is limited to sending the script output to users on the local system, so if you'd prefer to mail the report to some other system, just install one of the command line mail clients, e.g. mailx, and call it within the cron job script to mail the report file to wherever it should go.

There is a choice of Raspbian packages: mailx is included in the mailutils, heirloom-mailx and bsd-mailx packages, so either of the commands

sudo apt-get install heirloom-mailx or sudo apt-get install bsd-mailx

should do the trick. mailx can be configured to send mail through any mail server via an SMTP connection.

--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
org       |
Reply to
Martin Gregorie

See section 8 here:

formatting link

Reply to
Rob Morley
14 Dec 16 06:43, you wrote to all: JG> I wonder what is the easiest way from the command line (as I run some JG> of my Pi's without a GUI) to have a Pi send me a daily system JG> status report?

I would suggest ssmtp over the mailx and a full blown MTA like exim etc.

$ sudo apt-cache search ssmtp extsmail - enables the robust sending of e-mail to external commands

sudo apt-get install ssmtp

Can support SSL mail servers too if needed..

I use it in place of exim and a full MTA setup to send alerts from my BASH scripts on various boxes.

Rick

... Ding Dong the Witch is DEAD! I Made America Great Again! President Trump!

Reply to
Rick Christian

You can generate a snapshot with a cron job such as # /usr/bin/top -b -n1 -o %CPU

You can use ssmtp or msmtp to relay cron job output via gmail.

formatting link
formatting link

I use postfix (set as a localhost) and popa3d so I can get mail directly from the Pi.

--

Chris Elvidge, England
Reply to
Chris Elvidge

So how many ex-Goldman Saches employees has Trump hired for his adminstration, now? :-)

--
If you're not part of the solution, you're part of the precipitate.
Reply to
Jamie Kahn Genet

I have no idea. Do tell.

Reply to
The Natural Philosopher

So it's not that you actually care about Trump. It was just a blind hatred of Clinton?

Or is it both blind adoration of Trump and blind hatred of Clinton? Was there any intellectual involvement at all?

--
If you're not part of the solution, you're part of the precipitate.
Reply to
Jamie Kahn Genet

US politics, intellectual involvement - I'm experiencing cognitive dissonance.

-- Steve O'Hara-Smith | Directable Mirror Arrays C:>WIN | A better way to focus the sun The computer obeys and wins. | licences available see You lose and Bill collects. |

formatting link

Reply to
Ahem A Rivet's Shot

That's certainly been hammered home this year.

--
If you're not part of the solution, you're part of the precipitate.
Reply to
Jamie Kahn Genet

Please; it's not pi related.

--
Bah, and indeed, Humbug
Reply to
Kerr Mudd-John

I agree. So it probably shouldn't be introduced to a thread that has nothing to do with politics, within a group that has nothing to do with politics, inside the body of one's post :-)

But if it is, then I say it's fair game for a deservedly mocking reply.

--
If you're not part of the solution, you're part of the precipitate.
Reply to
Jamie Kahn Genet

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.