Linux – Where is this cron job running from

cronlinuxUbuntu

Some time ago, I set up a cron job to run a script every minute. Since then, I've upgraded the system from ubuntu intrepid to ubuntu karmic. Now the job is failing. I get email about it once a minute.

No problem, right? I can just solve the problem and go on my way. Well, ok, but I don't have time to do that right now, so I just want to shut the job off until I get around to it.

Ok, here's where it gets odd. I can't find the cron job. It's not in the crontab (under /var/spool/cron ) for the user (or any other user). It's not in /etc/crontab. It's not in /etc/cron.d. I've recursively grepped the whole of /etc/ and /var/ for the name of the script. Can't find it.

I've run lsof on the pid of the cron to see if it has some weird location I'm unfamiliar with open, no go.

What am I missing here? The job is running. It's being run by cron (Email comes from cron – I can see it in the system logs running under cron), but it doesn't appear to exist anywhere.

Best Answer

On my Debian system, /var/log/syslog contains an entry for each cron job which is executed …

Jan 17 20:10:01 machine1 /USR/SBIN/CRON[1545]: (convict) CMD (fetchmail -s >/dev/null 2>&1)
Jan 17 20:17:01 machine1 /USR/SBIN/CRON[1800]: (root) CMD (   cd / && run-parts --report /etc/cron.hourly)
Jan 17 20:20:01 machine1 /USR/SBIN/CRON[1914]: (convict) CMD (fetchmail -s >/dev/null 2>&1)

If your job is being executed by cron, you should find a reference to it in /var/log/syslog.

Related Topic