Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I have a cronjob set up like so:

~> crontab -l
0 * * * * /bin/bash -l -c 'cd /mnt/hgfs/kodiak && RAILS_ENV=test bundle exec 
    rake nightly_tasks --silent 2>> ./log/tasks_errors.log'

I can see that the cron job is running because it is being logged and the log is being updated. However when I use ps or ps -ef | grep cron I don't see the running job:

~> ps -ef | grep cron
 root      4228     1  0 09:14 ?        00:00:00 cron
 user      4233  3545  0 09:14 pts/3    00:00:00 grep --color=auto cron

I tried that same command with grep rake and didn't see rake in the list. I did try killing pid 4228 but it didn't stop the rake job from running. Killed it 3 or 4 times and still was seeing output in the logs (and the rake task went to the end).

How can I kill this cron job? It runs on the hour and takes about 20 mins to run (it does a lot and is running hourly because I'm testing it). I'm troubleshooting it and I'd like to kill it if it isn't running correctly, which I can see in the logs.

share|improve this question
    
I think cron spawns the job, so you wouldn't have a "cron" process related to that. I'd try ps wwuxa |grep rake. You say you already did? the process has to be there like you mention, I think you're doing it right, you may want to try with my "wwuxa" thing for ps just to cover all your bases. –  roadmr Jan 31 '12 at 19:52
    
@roadmr looks like the wwuxa switch did it. You should make that an answer. I'm not positive it'll catch the rake that was kicked off by cron yet, I'll have to wait for the job to start again. –  jcollum Jan 31 '12 at 20:39
add comment

1 Answer

up vote 1 down vote accepted

I think cron spawns the job, so you wouldn't have a "cron" process related to that. I'd try ps wwuxa |grep rake. You say you already did? the process has to be there like you mention, I think you're doing it right, you may want to try with my "wwuxa" thing for ps just to cover all your bases.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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