LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Ctrl-C kills background process also (https://www.linuxquestions.org/questions/linux-newbie-8/ctrl-c-kills-background-process-also-690664/)

Niraj Kulkarni 12-15-2008 04:41 AM

Ctrl-C kills background process also
 
Hi ,
I am working on uClinux 2.4.24 on ARM processor. Whenever I run some application in background (unsing "&" , for eg "ping 172.16.3.119 &")and press Ctrl-C , the background process also gets killed.
To my understanding Ctrl-C must kill only the foreground process.
What do i do so that Ctrl-C will not kill my background process.
Niraj

binary_pearl 12-15-2008 05:10 AM

Try the command: `nohup`

So you run it like this:
nohup some_command

Output will go to a file called nohup.out

--Shaun

Niraj Kulkarni 12-15-2008 05:29 AM

Thanks shaun
But there is no "nohup" command for my uClinux. Or else i will have to get source code for that command , compile it for my ARM processor (ARM ELF big-endian executable) and then use it.
Any other way...

binary_pearl 12-15-2008 06:11 AM

Do you have the command: `setsid` ?

That seemed to work for me also. If you don't have that, then the only other thing I can think of is to write a wrapper around the commands that you are using and trap ctrl-c. I would use this is a last resort though.

--Shaun


All times are GMT -5. The time now is 11:43 PM.