Date: Fri, 9 May 2014 21:22:29 +0000 (UTC) From: Benjamin Kaduk <bjk@FreeBSD.org> 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 Message-ID: <201405092122.s49LMTU4084309@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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 <tip> <para>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.</para> + 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:</para> + + <programlisting>env -i SHELL=/bin/sh PATH=/etc:/bin:/sbin:/usr/bin:/usr/sbin HOME=/home/<replaceable>dru</replaceable> LOGNAME=<replaceable>dru</replaceable> <replaceable>/usr/home/dru/bin/mycustomscript.sh</replaceable></programlisting> + + <para>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.</para> </tip> <para>When finished editing the crontab, save the file. It
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405092122.s49LMTU4084309>