On Sun 17 May 2020 at 19:14:46 (-0600), ghe wrote: > On Sunday, May 17, 2020 4:48 PM, David Wright <deb...@lionunicorn.co.uk> > wrote: > > > OK, I thought you might list both. I'm not actually sure where output > > goes because I always have MAILTO set, which takes care of it. > > Since I don't know what MAILTO is, I suspect I've never had to have it > set before:-) > > I looked around and found 'mailto's (LC) in my amanda config (it > points at root@localhost -- the amanda cron job script's another thing > that's missing). But nowhere else. > > Is MAILTO an environmental var? There's no MAILTO in 'env' when root > or backup (the amanda user) or ghe (me). There's a MAIL in the users' > environments, but I don't think that's what you're talking about. It's > pointed at /var/mail/<user> anyway.
$ man 5 crontab I believe the default is to mail to the user running the cron job. On a "home system", it obviously makes sense to centralise delivery, so I always include a MAILTO to me at localhost, at the top of every crontab file. (I always add SHELL to mine too.) Otherwise it might end up in /var/mail/ rather than my regular INBOX. > > Have you checked the logs? I see lines in both auth.log and syslog > > whenever cron jobs run, and even when I just look with crontab -l. > > I just looked at syslog and auth, and I don't see anything that looks > like email in there. And I sent crontab -l earlier -- nothing in there > either. > > What should I see? auth: May 17 15:10:01 wren CRON[30876]: pam_unix(cron:session): session opened for user root by (uid=0) May 17 15:10:05 wren CRON[30876]: pam_unix(cron:session): session closed for user root syslog: May 17 15:10:01 wren CRON[30878]: (root) CMD (apt-get -qq update && apt-get -qq -d upgrade && find /var/cache/apt/archives/ -name '*deb') and the output of the find gets emailed to me, as above. No output: then no email. (With systemd, you might need the journalctl command to see your log files.) I'm not sure why you see nothing: I just stick with the /etc/rsyslog.conf that the d-i installs from the netinst ISO. > Never mind, at least for a bit. I just found that the SMTP server is bent... That's why the logs are valuable. Of course you can test cron without needing any email output. For example, * * * * * DISPLAY=":0" /usr/bin/xeyes makes it pretty obvious whether it's working. Cheers, David.