0

I wrote a crontab that used to edit a file called some_file.txt every minute. So, every minute it used to keep getting renewed in my home directory. I would verify this by doing ls -alts every minute, and the time stamp would always be the current minute.

I want to stop the cronjob, so I did the following:

1) deleted the cronjob file

The process kept running, and the file kept updating everyminute.

2) did ps -A | egrep ".*cron.*" to find the cron job process. Killed the process with sudo kill <PID>. However, it still runs!

3) I also tried searching for the cron job by listing all existing cron jobs for all users, as shown here in this SO question. Still no luck!

how do I get rid of the procecss? Thanks.

Community
  • 1
  • 1
makansij
  • 9,303
  • 37
  • 105
  • 183

2 Answers2

0

Find process by running

sudo ps aux

Execute sudo kill -9 <PID> Restart cron`

When you run sudo kill <PID> the process get signal TERM. This signal could be intercepted by process. But when you execute sudo kill -9 <PID> the process get signal KILL and this signal could not be intercepted. You can find more info about signals here https://en.wikipedia.org/wiki/Unix_signal

zhigaev
  • 51
  • 7
0

crontab -r works.

I did not get a chance to try @zhigaev 's answer, but thank you.

makansij
  • 9,303
  • 37
  • 105
  • 183