Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!tut.cis.ohio-state.edu!ucsd!ames!amelia!wk35!truong From: truong@wk35..nas.nasa.gov (Tuong C. Truong) Newsgroups: comp.unix.questions Subject: Re: Killing a background process from a C program Message-ID: <7459@amelia.nas.nasa.gov> Date: 23 Jul 90 17:32:36 GMT References: <1990Jul19.151728.17448@ncs.dnd.ca> <1990Jul19.201116.13696@Neon.Stanford.EDU> Sender: news@amelia.nas.nasa.gov Organization: NASA Ames Research Center, Moffett Field, CA Lines: 23 In article <1990Jul19.201116.13696@Neon.Stanford.EDU> dkeisen@Gang-of-Four.Stanford.EDU (Dave Eisen) writes: >In article <1990Jul19.151728.17448@ncs.dnd.ca> marwood@ncs.dnd.ca (Gordon Marwood) writes: >> >>What I would like to do is start a background process at one point in the >>C program, and at a later time kill it. Currently I am invoking the >>background process with system("background_process &");, but none of the >>texts that I have available help me to proceed any further. >> > Just off the top of my head, but you may want to try something like : set PID = `background_process&` at this point PID will keep track of the process ID of the background process. later when you want to kill it, you may use something like: kill -9 $PID I have not tried this, but hope it works. ------------------------ Signature Under Construction.