title: how to set cron job from php script?
body: <p>i am new to cron job . i studied some basics about cron job . i can able to call php using cron tab. By using following command in /etc/crontab</p>
  
  <pre><code>  10 *    * * *   root    /usr/bin/php /var/www/PATH TO SCRIPT/email.php 
  </code></pre>
  
  <p>In email.php i have following code</p>
  
  <pre><code> #!/usr/bin/php
   &lt;?php
      mail ("examplemail@mail.com", "Cron Successful Public HTML!","Hello World from mycron.php!");
   ?&gt;
  </code></pre>
  
  <p>For every 10mins i am getting mail. 
  But i need to know is there any way to call cron job from php ( invoke cron from php)
  i get some idea by surfing but i am not able to figure out the exact way to do my job . 
  Here is code which i used to add job by using php </p>
  
  <pre><code>   exec('echo -e "crontab -e \n2 * * * * /usr/bin/php /var/www/PATH TO THE SCRIPT/crontest1.php" ');
  </code></pre>
  
  <p>Its not working for me. can anyone please guide me how to call or add cron from php. so tat i can send mail by executing php file &amp; can able change time interval in php file itself. </p>