From owner-svn-doc-head@FreeBSD.ORG Fri May 9 21:22:29 2014 Return-Path: Delivered-To: svn-doc-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6BF7E5B7; Fri, 9 May 2014 21:22:29 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59125812; Fri, 9 May 2014 21:22:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s49LMTLE084310; Fri, 9 May 2014 21:22:29 GMT (envelope-from bjk@svn.freebsd.org) Received: (from bjk@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s49LMTU4084309; Fri, 9 May 2014 21:22:29 GMT (envelope-from bjk@svn.freebsd.org) Message-Id: <201405092122.s49LMTU4084309@svn.freebsd.org> From: Benjamin Kaduk Date: Fri, 9 May 2014 21:22:29 +0000 (UTC) To: doc-committers@freebsd.org, svn-doc-all@freebsd.org, svn-doc-head@freebsd.org Subject: svn commit: r44805 - head/en_US.ISO8859-1/books/handbook/config X-SVN-Group: doc-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-doc-head@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: SVN commit messages for the doc tree for head List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 May 2014 21:22:29 -0000 Author: bjk Date: Fri May 9 21:22:28 2014 New Revision: 44805 URL: http://svnweb.freebsd.org/changeset/doc/44805 Log: Note that cron scripts run in a limited environment, and give an example for how to test scripts in such an environment. Approved by: hrs (mentor) Discussed with: dru Modified: head/en_US.ISO8859-1/books/handbook/config/chapter.xml Modified: head/en_US.ISO8859-1/books/handbook/config/chapter.xml ============================================================================== --- head/en_US.ISO8859-1/books/handbook/config/chapter.xml Fri May 9 20:25:28 2014 (r44804) +++ head/en_US.ISO8859-1/books/handbook/config/chapter.xml Fri May 9 21:22:28 2014 (r44805) @@ -362,9 +362,16 @@ PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin Before using a custom script, make sure it is executable - and test that it works as intended from the command line. - This is especially important if the script includes any - commands that deletes files using wildcards. + and test it with the limited set of environment variables set + by cron. To replicate the environment that would be used to + run the above cron entry, use: + + env -i SHELL=/bin/sh PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin HOME=/home/dru LOGNAME=dru /usr/home/dru/bin/mycustomscript.sh + + The environment set by cron is discussed in &man.crontab.5;. + Checking that scripts operate correctly in a cron environment + is especially important if they include any commands that delete + files using wildcards. When finished editing the crontab, save the file. It