Michael C. Toren on Mon, 6 Aug 2001 03:58:12 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] ending a process from outside


> Again, I know I could write a C or perl program that does a fork,
> waits four seconds in the parent, then kills the child with first
> SIGINT, then SIGKILL. And I know that wouldn't be very hard. But it
> seems there should be a simpler way.

As a quick hack, you could do something along the lines of the
following in bash:

    #!/bin/bash

    for f in $*; do
        xv $f & child=$!; disown
        sleep 4 || stop=1
        kill -TERM $child >/dev/null
        test $stop && break
    done

-mct