From owner-freebsd-stable@FreeBSD.ORG Sun Jan 29 01:15:24 2012 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A75D21065672 for ; Sun, 29 Jan 2012 01:15:24 +0000 (UTC) (envelope-from barnabus.pinklehorn@gmail.com) Received: from mail-we0-f182.google.com (mail-we0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 348E18FC0A for ; Sun, 29 Jan 2012 01:15:23 +0000 (UTC) Received: by werm13 with SMTP id m13so1221027wer.13 for ; Sat, 28 Jan 2012 17:15:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:content-type; bh=zLGCAFVzAnW/uQXneca5qVKKa0O4Z1wJhoMipfCidv4=; b=edRJjLj3cBQYYCAZjfeosuAQDoqPIaGlEtoM3FHh06o+olEhj4zh3mF96A0lmtlJTx SGJuskDwvDHfLJI/0a1BUQOIJPgoarcZQj8DPgy1rl88mHmqiyKx3dbDHXjDOetyovJ9 +KYUBcewUIrUpwtLWOlZ3vHv/nN+r5ezLD6Kg= Received: by 10.216.139.79 with SMTP id b57mr6731wej.22.1327797921345; Sat, 28 Jan 2012 16:45:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.223.104.133 with HTTP; Sat, 28 Jan 2012 16:45:01 -0800 (PST) From: Eric Bullen Date: Sat, 28 Jan 2012 16:45:01 -0800 Message-ID: To: freebsd-stable@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: Looks like a bug (or odd intended practice) in cron not honoring the PATH variable. X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Jan 2012 01:15:24 -0000 Hi All, I'm running the following: FreeBSD x 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 I couldn't figure out why SOME of root's cronjobs weren't running, and others were. Here's my test crontab for root: # PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/user/local/bin # * * * * * env > /tmp/x 2>&1 * * * * * curl > /tmp/y 2>&1 The 'curl' command resides in /usr/local/bin, and the output for /tmp/x, and /tmp/y are as follows: # tail -10 /tmp/x /tmp/y ==> /tmp/x <== LOGNAME=root PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/user/local/bin PWD=/ USER=root HOME=/ SHELL=/bin/sh ==> /tmp/y <== curl: not found The man (man 5 crontab) page says the following, but it LOOKS like cron is passing the environment to the command, but doesn't take the PATH env var as defined at top. "SHELL is set to /bin/sh, PATH is set to /usr/bin:/bin, and LOGNAME and HOME are set from the /etc/passwd line of the crontab's owner. HOME, PATH and SHELL may be overridden by settings in the crontab; LOGNAME may not." Not expected behavior. Thoughts? Please don't say that I should use absolute paths in my crontabs. I am well aware of the security implications. Thanks in advance! -Eric