Kill all currently running cron jobs

Posted by Adelphia on Server Fault See other posts from Server Fault or by Adelphia
Published on 2014-08-20T16:16:05Z Indexed on 2014/08/20 16:23 UTC
Read the original article Hit count: 170

Filed under:
|
|
|
|

For some reason my cron job scripts aren't exiting cleanly and they're backing up my server. There are currently a couple hundred processes running for one of my users. I can use the following command to kill all processes by that user, but how can I simplify this to kill only crons?

pgrep -U username | while read id ; do kill -6 $id ; done

It would be dangerous to run the above command as is, correct? Wouldn't that kill mysql and other important things?

© Server Fault or respective owner

Related posts about bash

Related posts about cron