how to stop a started cron job - Unix

This is a discussion on how to stop a started cron job - Unix ; 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 ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: how to stop a started cron job

  1. how to stop a started cron job

    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.


  2. Re: how to stop a started cron job

    On 27 Sep 2006 15:55:18 -0700, 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?

  3. Re: how to stop a started cron job

    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 ***

  4. Re: how to stop a started cron job

    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.


+ Reply to Thread