From nobody Fri Jan 9 20:17:26 2026 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dntNl3fS2z6MJw7 for ; Fri, 09 Jan 2026 20:17:27 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dntNk6Txxz3KWT for ; Fri, 09 Jan 2026 20:17:26 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767989846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xvl1eU+0I7bFQiELZim5tqyD4eK4bwPg6qNaAK2lMqg=; b=IWz0D0RdFx8sdETJAgZRZhVVBp7zOmUP1SI5Cr7JKBusdRU0/d3dpZknrNE67UBXYpwxce DHpINbkgcNo3ztZ3mLua0NvW9IMpsUdDBefeNiuF/02Sya7nXCJqlWUwrIgfQJZa+mYglk pPJWJHCQEEFN7/bATuAz3kkOvjo+Mi7abm2+u2ZF+uGistAb1WljI+J7J1g52PDU5rbSO6 sbfWzmjfR6EydZpc5qGeclxBOzIBCHorTOIOQOP73eB0ETsxIdaO7JPp1UClrbn1JPPxp8 DfzL5JXHEJdMeNtMZ+NsQqtX+SUzO062JghZqi18wANq3cv9WBz2QnSUVogTQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1767989846; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=xvl1eU+0I7bFQiELZim5tqyD4eK4bwPg6qNaAK2lMqg=; b=IoWCXG+9jjtxG7J7Nwjpp4DdElaPWAifYbs3gm93hK0b0VMFHe2l7SwpFINligRtAyrlve GFk6jzrw4O2XO3XaIQXGXHLBLj1G0DLd3BOsbmMp7Vg+K6pav+6c9pegbpODhP3dIWK78c bTCnIApY98EgRFEVlNxIgDIF4/XrbXTEGjt+VdeixpPRaaH/q3G6PFZB/5EfDE+h2h4aVs NgqlYD5/201NUrWTrsGE1+NPGRsvsuKtUQPT1RLifBR6PyzJ/J3IKLCQu9HsTJvPCSvwgP 9RHuQAfAntW4XCnvdfc7tctS3PLgIQCRN+T+Wh/0q+tki/FDpgBXQh/sNLnmAQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1767989846; a=rsa-sha256; cv=none; b=f6fsEHcijtX+kh/MPLWbgUQoWAMN22nTsw0ziha8KjX87SQ3SaBzpijqEXM57gyigl2MIF xP8iWNf0lcrBBmjf7JHZENabuoVkDaU9IdjfSSqDjsBMJ08b2A1ihY3Azcd34GNhZZ39Ja xepuAqQF23gs2eXQHbu+QXThejsfs0QU4rSMCErwoKw+K7sY6w0Ph9KE9UqmcXmdgCLNP5 bUFFODfJtK+IaxQ1guOwEs+9piNiIeAm1t8H7Y7KiEBHkp5XYJ5Dg0kX9pbpzp1kObnyni 0CSJX+vcvMR4M3XaLMfT6JTvkMIjqIywxnAu5ZdNoFInllMZcOEfEPBy1ecQSg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dntNk64rSz7gb for ; Fri, 09 Jan 2026 20:17:26 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 8983 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 09 Jan 2026 20:17:26 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Lakshmikanth Ayyadevara From: Warner Losh Subject: git: 3e72ce4081f4 - main - Cron: add CC and BCC option for crontab variables List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3e72ce4081f4a8d6b1d879dae201d569ce450261 Auto-Submitted: auto-generated Date: Fri, 09 Jan 2026 20:17:26 +0000 Message-Id: <69616256.8983.4372cc3b@gitrepo.freebsd.org> The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=3e72ce4081f4a8d6b1d879dae201d569ce450261 commit 3e72ce4081f4a8d6b1d879dae201d569ce450261 Author: Lakshmikanth Ayyadevara AuthorDate: 2025-10-02 16:08:09 +0000 Commit: Warner Losh CommitDate: 2026-01-09 20:17:12 +0000 Cron: add CC and BCC option for crontab variables Signed-off-by: Lakshmikanth Ayyadevara Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1865 --- usr.sbin/cron/cron/do_command.c | 6 +++++- usr.sbin/cron/crontab/crontab.5 | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/usr.sbin/cron/cron/do_command.c b/usr.sbin/cron/cron/do_command.c index 43b3269d3087..58eed70c1be6 100644 --- a/usr.sbin/cron/cron/do_command.c +++ b/usr.sbin/cron/cron/do_command.c @@ -82,7 +82,7 @@ child_process(entry *e, user *u) { int stdin_pipe[2], stdout_pipe[2]; char *input_data; - const char *usernm, *mailto, *mailfrom; + const char *usernm, *mailto, *mailfrom, *mailcc, *mailbcc; PID_T jobpid, stdinjob, mailpid; FILE *mail; int bytes = 1; @@ -104,6 +104,8 @@ child_process(entry *e, user *u) */ usernm = env_get("LOGNAME", e->envp); mailto = env_get("MAILTO", e->envp); + mailcc = env_get("MAILCC", e->envp); + mailbcc = env_get("MAILBCC", e->envp); mailfrom = env_get("MAILFROM", e->envp); #ifdef PAM @@ -547,6 +549,8 @@ child_process(entry *e, user *u) fprintf(mail, "From: Cron Daemon <%s>\n", mailfrom); fprintf(mail, "To: %s\n", mailto); + fprintf(mail, "CC: %s\n", mailcc); + fprintf(mail, "BCC: %s\n", mailbcc); fprintf(mail, "Subject: Cron <%s@%s> %s\n", usernm, first_word(hostname, "."), e->cmd); diff --git a/usr.sbin/cron/crontab/crontab.5 b/usr.sbin/cron/crontab/crontab.5 index e4e6fae0b01b..5353e3de1b00 100644 --- a/usr.sbin/cron/crontab/crontab.5 +++ b/usr.sbin/cron/crontab/crontab.5 @@ -128,9 +128,19 @@ If is defined (and non-empty), mail is sent to the user so named. If +.Ev MAILCC +is defined (and non-empty), mail is carbon copied to the user(s) so named. +.Ev MAILBCC +is defined (and non-empty), +mail is blind carbon copied to the user(s) so named. +If .Ev MAILFROM is defined (and non-empty), its value will be used as the from address. .Ev MAILTO +, +.Ev MAILCC +and +.Ev MAILBCC may also be used to direct mail to multiple recipients by separating recipient users with a comma. If @@ -298,7 +308,9 @@ is started or the crontab entry is reloaded. SHELL=/bin/sh # mail any output to `paul', no matter whose crontab this is MAILTO=paul -# +# CC and BCC mail to `lakshmikanth@example.com' and 'paul@example.com' +MAILCC=lakshmikanth@example.com,paul@example.com +MAILBCC=peter@example.com # run five minutes after midnight, every day 5 0 * * * $HOME/bin/daily.job >> $HOME/tmp/out 2>&1 # run at 2:15pm on the first of every month -- output mailed to paul