I have created cron jobs for my site which is listed below and they are working fine. I print all cron job by using this PHP script:
$cronfiles=exec('crontab -l',$output);
echo "<pre>";
print_r($output);
Which outputs:
[0] => 0 0 * * * wget php -q http://www.example.com/report_send.php
[1] => 0 0 * * * wget php -q http://www.example.com/event_reminder.php
[2] => 0 0 * * * wget php -q http://www.example.com/user_reminder.php
[3] => * * * * * wget php -q http://www.example.com/cleardata.php
Now I want to delete or remove a single cron job from my server through command. For example I want to remove cron job "0 0 * * * wget php -q http://www.example.com/event_reminder.php
" from server.
I tried crontab -r
command which removes all cron job from my server but i want to remove specific cron job.
Can you please help me for solution?
crontab -l 2 > /dev/null
is only necessary if you don't want to see the messageno crontab for <user>
if there is no existing cron job. By the way, we don't need the option-u mobman
if we want to add the cron job for the current user. – baptx Nov 26 '17 at 23:13-
has no special (syntactic) meaning: it's just a string as, for instance,"a"
. It's some sort of convention, though, that some programs interpret-
as "read from stdin". (The actual stdin is usually/dev/stdin
). – Luis Lavaire Aug 16 '20 at 20:08