Published: October 16, 2020 • 2 min read
Here’s a familiar scenario: you open a new terminal, and before the prompt appears, you see the following.
You have new mail.
What’s going on here?
Events in your operating system can send messages to your mail queue. Although it’s tempting to ignore them because they aren’t colored red or filled with threatening language, you should not ignore these messages. In most cases, your operating system is trying to tell you something important.
Inspect these messages with the
$ mail "/var/mail/jake": 60 messages 60 unread ...
Uh oh, 60 unread messages! Time to get reading. Read each message with
p to print the current message. Go fix what’s wrong, and then
dispose of the message with
Alternatively, you can read this mail file directly. Here’s an example entry:
firstname.lastname@example.org Wed May 20 15:19:20 2020 Return-Path: <email@example.com> X-Original-To: jake Delivered-To: firstname.lastname@example.org Received: by computer.localdomain (Postfix, from userid 501) id 67A83203EC4B55; Sat, 20 Jun 2020 15:19:19 -0400 (EDT) From: email@example.com (Cron Daemon) To: firstname.lastname@example.org Subject: Cron <jake@computer> afplay /System/Library/Sounds/Ping.aiff X-Cron-Env: <SHELL=/bin/sh> X-Cron-Env: <PATH=/usr/bin:/bin> X-Cron-Env: <LOGNAME=jake> X-Cron-Env: <USER=jake> Message-Id: <20200520191920.67A83202EC2B53@computer.localdomain> Date: Wed, 20 May 2020 15:19:19 -0400 (EDT) Status: O Error: AudioQueueStart failed (-66681)
Cron portion of
Subject: reveals that this message is from a failing
cron job. All of my messages are the result of problematic cron commands; in
fact that’s a great way to pile up a bunch of automated mail messages. Fix the
commands and clear out the mail.
✉️ Get better at programming by learning with me. Subscribe to Jake Worth's Newsletter for bi-weekly ideas, creations, and curated resources from across the world of programming. Join me today!
Blog of Jake Worth, software engineer in Maine.