LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   [C++] Run in background when Ctrl+C entered (https://www.linuxquestions.org/questions/programming-9/%5Bc-%5D-run-in-background-when-ctrl-c-entered-477363/)

TomGibbons 08-25-2006 03:19 PM

[C++] Run in background when Ctrl+C entered [RESOLVED]
 
I'm not sure how many of you have used the Asterisk PBX but what I'd like to do is have my application run in the background, instead of closing, when Ctrl+C is pressed. Asterisk does this and you then run 'asterisk -r' to connect to it again.

Any ideas how I could do this?

Thank you

acid_kewpie 08-25-2006 03:23 PM

do you just mean how do you background a process? Ctrl+z then run "bg".

TomGibbons 08-25-2006 04:16 PM

No I already know how to run a process in the background. It's a similar thing to that, however, in Asterisk I simply hit Ctrl+C and it runs in the background. I reconnect to the running PBX by passing an R argument.

dopehouse 08-26-2006 06:02 AM

Asterisk is already running in the background. if you start asterisk with asterisk -r, you only use the new asterisk process as an terminal client to connect to the asterisk process which is running in server mode. if you hit ctrl+c, you just kill the client which communicates via IPC with the asterisk server.

TomGibbons 08-26-2006 08:51 AM

Thank you. That's what I needed to know.


All times are GMT -5. The time now is 03:09 PM.