This is a quick PHP script to delete only a single cron job. This does not remove the whole crontab. You specify which cron command to remove. Just replace line 1 with your own cron command that you would like to delete.
(See instead how to create a cron job with PHP.)
$job = '0 * * * * php /home1/myypath/etc/mycron.php >/dev/null 2>&1'; // Remove a single cron job exec('crontab -l', $data); $key = array_search($job, $data); if($key !== false){ // the job was found, so remove it unset($data[$key]); // put the data back into the crontab exec('echo "'.implode("\n", $data).'" | crontab -'); }
Questions and Comments are Welcome