LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 03-01-2010, 07:25 AM   #1
bendib
Member
 
Registered: Feb 2009
Location: I'm the rat in your couch.
Distribution: Fedora on servers, Debian on PPC Mac, custom source-built for desktops
Posts: 174

Rep: Reputation: 40
How to relaunch process after it terminates in C++


OK, I am trying to relaunch a process after it's name, not pid, terminates. Is this possible? Though I do not see how this would help, I am using g++ 4.3-4.4 on Fedora 10, wandering between my x86 and ppc machines. I just recompile. Thanks, Ben.
 
Old 03-01-2010, 10:15 AM   #2
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by bendib View Post
OK, I am trying to relaunch a process after it's name, not pid, terminates. Is this possible? Though I do not see how this would help, I am using g++ 4.3-4.4 on Fedora 10, wandering between my x86 and ppc machines. I just recompile. Thanks, Ben.
How is relaunching different from launching ?
 
Old 03-01-2010, 11:16 PM   #3
bendib
Member
 
Registered: Feb 2009
Location: I'm the rat in your couch.
Distribution: Fedora on servers, Debian on PPC Mac, custom source-built for desktops
Posts: 174

Original Poster
Rep: Reputation: 40
Ug. you know what I mean. I don't know how to trigger this when it detects that a certain process has died. Thanks.
 
Old 03-02-2010, 04:29 AM   #4
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

I don't think adding it to the application will be a good idea. You can set up signal handlers, but there are many things to consider, for example shutting down the computer.

A better solution would be to write a shell script to start/restart the process. If you install mysql server on a Debian/Ubuntu system, the daemon is run by a shell script that checks for crashes among many other things. Take a look at the /usr/bin/mysqld_safe script.
 
  


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
TOP process left running when Putty terminates Wilhelm Linux - Newbie 2 07-13-2009 10:13 AM
Squid process terminates for no apparent reason. Palula Linux - Software 12 04-11-2008 08:39 AM
LXer: Firefox Site Gets a Relaunch LXer Syndicated Linux News 0 02-12-2007 02:54 PM
How do I keep an executable from terminates after the initiating shell terminates mr.v. Linux - Newbie 8 01-20-2007 02:47 AM
Relaunch XFDrake to Configure Nvidia Card ? dolphans1 Mandriva 1 08-21-2004 11:53 AM

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

All times are GMT -5. The time now is 11:00 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