How to triger a timer/signal to a running program

Lee Harr missive at frontiernet.net
Mon Jul 1 19:49:48 EDT 2002


In article <afpgu9$gc909$1 at ID-89260.news.dfncis.de>, nicholas wang wrote:
> Hi,all
>   My task is to kill a program when it runs more than a limited time.
>   My plat is Linux7.1; I've tried Csh to make it using ps ... ; then kill
> this program. But it will get extra  messages to stdout. Of course, use
> "limit" command also works. But both are not perfect.
>   I know Perl get a command "alarm" will do such a job
>   I'm searching a Python counterpart. Does anyone know what it is?
> My idea about this job is: ( in a python shell )
>   1. mark a signal to a specific program.
>   2. run this program
>   3. if time exceeds limit(set before run), the shell will kill it.
>   2. continue to run the remained commands.
> 

Maybe something in the signal library can help.
signal is a module in the standard library.




More information about the Python-list mailing list