1and1 Help Centre Categories

print article

Delete a Cron Job

For Linux packages

In this article you will learn how to delete a Cron Job.

There are three options when removing Cron Jobs. The first is that the entire Crontab can be deleted will erase all Cron Jobs. The second is that the Crontab can be edited to remove the line that contains the Cron Job. The third option is editing the Crontab to comment out the line that contains the Cron Job, leaving the Cron Job there for use later if necessary.

Regardless of the option chosen, SSH access is required. Please log into your Webspace via SSH from your PC or from your Mac.

Deleting or disabling a specific Cron Job
Step 1
To delete or comment out a Cron Job from the Crontab, simply type
crontab -e

to edit the Crontab. To exit the Crontab at any time (in case a mistake is made) simply press the Esc key and then type :q! and press ENTER to quit without(!) saving.

(uiserver):u50477533:~ > crontab -e
Step 2
Once the Crontab has been opened using the VI editor, use your arrow keys to place the cursor at the beginning of the Cron Job line that is to be deleted or commented out. To insert the hash symbol(#) so that the line is commented, press the i key to insert text and then add the hash symbol to the very beginning of the line.
# m h dom mon dow command
#* * * * * /usr/bin/php /kunden/homepages/11/d256250497/htdocs/cronTest.php
~
~
~
~
~
~
~
~
~
~
-- INSERT -- 2,2 All

Or to delete a Cron Job from the Crontab altogether, make sure that the cursor is at the very beginning of the Cron Job line that is to be removed and type dd by pressing the d key twice. This should remove the entire line.

# m h dom mon dow command
~
~
~
~
1,1 All
Step 3

To save your changes, press the Esc key and then type :x and press ENTER to exit and save changes.

# m h dom mon dow command
~
~
~
~
:x

The Crontab should update.

~
~
~
"crontab.UU08Z8/crontab" 1L, 29C written
crontab: installing new crontab
(uiserver): 50477533:~ >

Step 4

Next, check the Crontab by typing crontab -l (lowercased L) and pressing ENTER to list the Crontab. The line(s) removed should no longer be listed in the Crontab.

"crontab.UU08Z8/crontab" 1L, 29C written
crontab: installing new crontab
(uiserver): 50477533:~ > crontab -l
# m h dom mon dow command
(uiserver): 50477533:~ >
Deleting all Cron Jobs within the Crontab
Step 1
To delete the entire Crontab simply type
crontab -r

and press ENTER to remove or delete the entire Crontab.

(uiserver):u50477533:~ > crontab -r
Step 2
Next, type
crontab -l

to list the crontab and verify that all Cron Jobs have been removed.

(uiserver):u50477533:~ > crontab -r
(uiserver):u50477533:~ > crontab -l
no crontab for u50477533
(uiserver):u50477533:~ >