2

I have in /etc/crontab a job defined like this:

0,10,20,30,40,50 * * * * root /usr/lib/cgi-bin/awstats.pl -config=example.com -update

I deleted this job but cron sends me still emails every ten minutes.

How can I stop these emails?

My OS is Raspbian 9 Stretch.

Thanks a lot

3
  • 1
    Just to make sure, did you use "crontab -e" to delete that line or edit some files unbeknownst to cron?
    – Ghanima
    Commented Sep 19, 2018 at 19:15
  • I added the line in sudo nano /etc/crontab then i deleted it out of sudo nano /etc/crontab
    – wolf
    Commented Sep 19, 2018 at 20:05
  • @wolf You MUST use crontab -e to edit a user cron table or sudo crontab -e to edit the root cron table. Doing anything else will have unknown consequences.
    – joan
    Commented Sep 19, 2018 at 21:50

1 Answer 1

3

Always use

crontab -e 

to edit the current users crontab entries or

sudo crontab -e

to create, edit, or delete crontab entries for the user root. Do not edit any files belonging to cron directly. That just will not work.

See bullet 10 here:

User crontab files are stored by the login names in different locations in different Unix and Linux flavors. These files are useful for backing up, viewing and restoring but should be edited only with crontab command by the users.

3
  • In /etc/crontab you can run a task with a different user. I'd like to run the job as root. You can define that there. The file looks almost the same as crontab -e.
    – wolf
    Commented Sep 19, 2018 at 20:29
  • Use sudo to edit root’s crontab Commented Sep 20, 2018 at 2:20
  • Thanks a lot. I managed it. I had to delete the file awstats in the /etc/cron.d directory.
    – wolf
    Commented Sep 20, 2018 at 15:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.