Re: Abbrechen eines Programms, das in einem Bash Skript gestartet wird.

[email protected]
Newsgroups gmane.linux.suse.programming
Message-ID <43DF3630.18654.3987EF@localhost>
Am 31 Jan 2006 um 9:21 hat [email protected] geschrieben:

Vielleicht hilfts:

## install trap for automatic deletion of TMPFILE and MSGFILE at
## SIGEXIT (0) see 'man bash' and all other signals. The trap for
## SIGKILL (9) is ignored though, of course. See 'help trap'.
trap "rm -f \"$TMPFILE\"; rm -f \"$MSGFILE\";" `seq 0 63`

Lothar

> 
> 
> Hallo,
> ich habe folgende Situation. Ein C++ Programm ruft mit execve ein Bash
> Skript auf und wartet mit waitpid() auf die normale Beendigung. Wenn die
> Ausführung des Skriptes zu lange dauert, soll es mit kill(pid, SIGKILL)
> beendet werden. Das Skrpt selber ruft wieder ein C++Programm auf. Jetzt
> ensteht folgende Situation.
> Nach dem kill() geht das Skript in den Status defunct und das vom Skript
> aufgerufene Programm läuft normal weiter. Hierzu jetzt 2 Fragen:
> Wie kann ich erreichen, dass auch das vom Skript aufgerufene Programm
> beendet wird, also das kill() quasi weitergegebe wird?
> Wir verhindere ich, dass das Skript in defunct geht? Ich muss
> wahrscheinlich nach kill nochmal waitpid() aufrufen, möcht hier aber nicht
> ewig warten müssen.
> 
> Vielen Dank im voraus für eure Hilfe.
> 
> Gruß
> Bernard


-- 
Lothar Behrens	|	Rapid Prototyping ...
Rosmarinstr 3		|	
40235 Düsseldorf  	|	www.lollisoft.de




-- 
Um die Liste abzubestellen, schicken Sie eine Mail an:
    [email protected]
Um eine Liste aller verfügbaren Kommandos zu bekommen, schicken
Sie eine Mail an: [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.