svn commit: r44805 - head/en_US.ISO8859-1/books/handbook/config

Benjamin Kaduk bjk at FreeBSD.org
Fri May 9 21:22:29 UTC 2014


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


More information about the svn-doc-all mailing list