|
Home > Archive > Unix administration > September 2006 > how to stop a started cron job
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
how to stop a started cron job
|
|
| linq936@hotmail.com 2006-09-27, 7:37 pm |
| Hi,
In my crontab I call a script and that script calls a lot other
programs. I find that it is difficult to stop the cron job once it is
started.
What I just did is use "ps -A" to get all the started processes
including that script, and run kill command to stop them one by one.
Is there any better way to kill the started cron job?
Thanks.
| |
| Dave Hinz 2006-09-28, 1:39 am |
| On 27 Sep 2006 15:55:18 -0700, linq936@hotmail.com <linq936@hotmail.com> wrote:
> Hi,
> In my crontab I call a script and that script calls a lot other
> programs. I find that it is difficult to stop the cron job once it is
> started.
>
> What I just did is use "ps -A" to get all the started processes
> including that script, and run kill command to stop them one by one.
>
> Is there any better way to kill the started cron job?
Well, the fact that it was started by cron isn't relevant once it's been
started. You are kicking off a parent process which then spawns child
processes, right? What happens when you kill the parent process?
| |
| Barry Margolin 2006-09-28, 1:39 am |
| In article <1159397718.412569.184740@b28g2000cwb.googlegroups.com>,
linq936@hotmail.com wrote:
> Hi,
> In my crontab I call a script and that script calls a lot other
> programs. I find that it is difficult to stop the cron job once it is
> started.
>
> What I just did is use "ps -A" to get all the started processes
> including that script, and run kill command to stop them one by one.
>
> Is there any better way to kill the started cron job?
>
> Thanks.
All the processes will most likely be part of the same process group,
whose PGID should be the PID of the shell process that runs the script.
So find that process, and kill the negative of its PID, and this should
kill the whole group.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
| |
| Doug Freyburger 2006-09-28, 1:39 am |
| linq936@hotmail.com wrote:
>
> In my crontab I call a script and that script calls a lot other
> programs. I find that it is difficult to stop the cron job once it is
> started.
>
> What I just did is use "ps -A" to get all the started processes
> including that script, and run kill command to stop them one by one.
>
> Is there any better way to kill the started cron job?
Name the script something easy to grep for. Use ptree to see all
the processes it launched. kill them however you need to make
them all die cleanly.
|
|
|
|
|