LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-25-2006, 03:19 PM   #1
TomGibbons
Member
 
Registered: Sep 2003
Location: San Diego, CA
Distribution: Fedora 8 and CentOS 5.1
Posts: 31

Rep: Reputation: 15
[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

Last edited by TomGibbons; 08-26-2006 at 08:52 AM.
 
Old 08-25-2006, 03:23 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
do you just mean how do you background a process? Ctrl+z then run "bg".
 
Old 08-25-2006, 04:16 PM   #3
TomGibbons
Member
 
Registered: Sep 2003
Location: San Diego, CA
Distribution: Fedora 8 and CentOS 5.1
Posts: 31

Original Poster
Rep: Reputation: 15
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.
 
Old 08-26-2006, 06:02 AM   #4
dopehouse
Member
 
Registered: May 2004
Location: Hildesheim(Germany)
Distribution: Debian Etch with Kernel 2.6.x (latest vanila)
Posts: 62

Rep: Reputation: 15
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.
 
Old 08-26-2006, 08:51 AM   #5
TomGibbons
Member
 
Registered: Sep 2003
Location: San Diego, CA
Distribution: Fedora 8 and CentOS 5.1
Posts: 31

Original Poster
Rep: Reputation: 15
Thank you. That's what I needed to know.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C++: Way to have System run in background? dive Programming 3 08-17-2006 07:29 PM
Run in the background even after logging off rust8y Linux - Newbie 13 05-19-2006 06:38 AM
how to run a process in the X background sh4d0w13 Linux - General 6 09-12-2005 02:54 PM
how to run any binary in background - background process tej Linux - Newbie 1 08-16-2004 12:27 AM
Run programs in background... Cybers19 Linux - Newbie 1 06-02-2004 03:54 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration