title: Cron Job Does Not Sop after task completion
body: <p>How to stop a cron job after the task is completed?</p>
  
  <p>The job of cron to transfer a set no. of email id's from 1 sql table to another using given specific restrictions. The task executes but does not stop. It re-runs to add duplicate values the table but the limit setting in the php file is not working.</p>
  
  <p>I have posted the code here......</p>
  
  <pre><code>    &lt;?php
      $con = mysql_connect("","","") or die(mysql_error());
  
      mysql_select_db("email_vijaya",$con) or die(mysql_error());
  
      session_start();
      ?&gt;
      &lt;?php  $ref = mysql_query("SELECT * FROM Email_Transford_Count WHERE status = '1'"); ?&gt;
  
      &lt;?php if(mysql_num_rows($ref) == '0')  { ?&gt;
  
      &lt;?php } else { ?&gt;
  
      &lt;?php while($yr = mysql_fetch_array($ref)) { ?&gt;
  
      &lt;?php $actual_Count = $yr['Actual_Count']; ?&gt;
  
      &lt;?php $Uploaded_ctual = $yr['Rest_Count']; ?&gt;
  
      &lt;?php $rest = ($actual_Count)*1-($Uploaded_ctual)*1; ?&gt;
  
      &lt;?php $re = $yr['Rest_Count']; ?&gt;
  
      &lt;?php  if($actual_Count &gt;= $Uploaded_ctual) { ?&gt;
  
      &lt;?php $country = mysql_query("select Email_IDs from eData where City = '".$yr['city']."' AND category = '".$yr['category']."' limit $re"); ?&gt;
  
      &lt;div class="email_css"&gt;
  
      &lt;?php while($u = mysql_fetch_assoc($country)) { ?&gt;
  
      &lt;?php mysql_query("UPDATE Email_Transford_Count SET Rest_Count = Rest_Count+1 WHERE User_id = '".$yr['User_id']."' AND category = '".$yr['category']."' AND status = '1' "); ?&gt;
      &lt;?php  if($actual_Count &gt;= $Uploaded_ctual) { ?&gt;
      &lt;?php mysql_query("INSERT INTO eData_ClientTransfered VALUES ('','".$yr['User_id']."','".$u['Email_IDs']."','".$yr['category']."','1')"); ?&gt;
  
      &lt;?php } ?&gt; 
      &lt;?php } ?&gt; 
      &lt;?php  } else { ?&gt;
  
      &lt;?php mysql_query("UPDATE Email_Transford_Count SET status = '2'      WHERE User_id = '".$yr['User_id']."' AND status = '1'"); ?&gt;
  
  
      &lt;?php } ?&gt;
  
      &lt;?php } ?&gt;
  
      &lt;?php }  ?&gt;
  </code></pre>