0

My question is how to find a specific cron job?

I have a cron job that runs daily on my web/email server and I'm sure it exists, because I get an email every day about it. It's a LetsEncrypt SSL certificate renewal. Now I want to modify it, but I can't find it anywhere.

(Edit: moved "things I've tried" from here into the answer)

Atte Juvonen
  • 4,922
  • 7
  • 46
  • 89

2 Answers2

0

Does your web/email server has got any services deployed in containers? Check the output of 'docker ps' and see if there are any running related web/email services. Connect to those instances and find the cron entries if any.

sasubillis
  • 76
  • 5
0

Cron jobs are either user specific or system wide. You can list user specific cron jobs for all users by running the following command as root:

for user in $(cut -f1 -d: /etc/passwd); do crontab -u $user -l; done (source)

If it's not found, it's probably a system wide cron job and it's located in one of the following folders:

etc/crontab 
etc/cron.d
etc/cron.daily
etc/cron.hourly
etc/cron.monthly
etc/cron.weekly

Try running: grep -rnw '/etc/' -e 'keyword'

This command lists you all the files inside /etc/ which contain the keyword you are looking for, so it might also list you unrelated files.

In my case, the LetsEncrypt certificate renewal job turned out to be in etc/crontab, which I thought I had checked already with crontab -e, but it turns out they are different: crontab -e is for user specific cron jobs, while etc/crontab is for system wide cronjobs. This is also the reason why this cron job didn't appear when I was listing all cron jobs for all users.

Community
  • 1
  • 1
Atte Juvonen
  • 4,922
  • 7
  • 46
  • 89