troubleshooting Question

Want to timestamp into the cron logfile

Avatar of Dr. Klahn
Dr. Klahn asked on
Linux* cronjobs* Debian* Cron
10 Comments1 Solution71 ViewsLast Modified:
I would like to put a timestamped separator in the cron log at midnight:

==================== 23 March 2020 ====================

I've put an echo line into /etc/crontab, and that sends me an email that I don't want.

I've put an extended line into the crontab prefacing the echo line with { MAILTO=""; (echo here); } and that still sends the unwanted email.

I've written a script with MAILTO="" and echo lines in it which works splendidly on the console and does not send the unwanted email, but puts nothing into the cron log file.

goofling around produced no immediate results.  But Debian does something close to this, because the cron log was showing single-line timestamps when I brought the system up -- and then discovered how to disable, which I did by deleting instead of commenting out.

Is there a simple way to do this?
Dr. KlahnPrincipal Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 10 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros