title: Using Relative Paths in Crontab
body: <p>I am attempting to use relative paths in my crontab file on CentOS 6.4, so that I do not have to repeat the same absolute path over and over again. At the top of my crontab file, located here: <code>/etc/crontab</code>, I have:</p>
  
  <pre><code>SHELL=/bin/bash
  PATH=/var/www/html/crons
  MAILTO=""
  HOME=/
  </code></pre>
  
  <p>And each of my commands looks like:</p>
  
  <pre><code>*/2 * * * * root /usr/bin/php "cronfile.php" &gt;&gt; "logs/cronfile_"`date +\%Y\%m\%d`".log"
  </code></pre>
  
  <p>I'm expecting that it'll run the <code>cronfile.php</code> PHP file in the <code>/var/www/html/crons</code> directory, and save the output from this to <code>/var/www/html/crons/logs/cronfile.log</code>. However, the file is not being run and the log file is not being created.</p>
  
  <p>The command works fine if I run just:</p>
  
  <pre><code>/usr/bin/php "cronfile.php" &gt;&gt; "logs/cronfile_"`date +\%Y\%m\%d`".log"
  </code></pre>
  
  <p>from the command line after <code>cd</code>ing into the <code>/var/www/html/crons</code> directory.</p>
  
  <p>Please advise, thanks.</p>