On 12/06/2020 14.37, Dave Howorth wrote:
I run some cron jobs on a Raspberry Pi and would like to see output emailed by cron on my [separate] opensuse box. The Pi by default has no mail software installed, so I'd like to find the smallest/simplest way of enabling its cron to forward mail to my opensuse host on the LAN.
My opensuse box has the usual postfix, mailx etc stuff, which I confess to not knowing much about, and claws-mail that I use as my MUA.
Do I need to install (and configure :( ) postfix on my Pi or is there some other way to send mail that is less complicated. Or some other way to get cron to send its output?*
It is possible to send mail by using mailx only, but you need having another machine in the network that has a listening postfix, so that you configure mailx to use it instead: man mail: smtp Normally, mailx invokes sendmail(8) directly to transfer messages. If the smtp variable is set, a SMTP connection to the server specified by the value of this variable is used instead. If the SMTP server does not use the standard port, a value of server:port can be given, with port as a name or as a number. There are two possible methods to get SSL/TLS encrypted SMTP sessions: First, the STARTTLS com- mand can be used to encrypt a session after it has been initiated, but before any user-related data has been sent; see smtp-use-starttls above. Sec- ond, some servers accept sessions that are encrypted from their beginning on. This mode is configured by assigning smtps://server[:port] to the smtp variable. The SMTP transfer is executed in a child process; unless either the sendwait or the verbose variable is set, this process runs asynchronously. If it receives a TERM signal, it will abort and save the message to the `dead.letter' file. However, I'm afraid you can't then tell cron to use mailx in the "MAILTO=" line.
* At the moment I make it write all the output from the jobs to files in a directory under /var/log but: (a) that means I have to actively go to the Pi to check them rather than have them delivered to my desktop, and (b) it only keeps the last output from each job, which is normally OK but could cause grief.
You could select the name based in datetime instead of a fixed name :-? -- Cheers / Saludos, Carlos E. R. (from 15.1 x86_64 at Telcontar)