LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-05-2010, 12:28 PM   #1
prudens
Member
 
Registered: Jul 2009
Posts: 52

Rep: Reputation: 15
Restart Program when crashed


I have a program called HelloWorld, but it crashes a lot,

is there anyway to tell Linux to automatically check if Hello World crashed, and if it is crashed, restart HelloWorld?

Thanks!

P.S. Running Ubuntu

Last edited by prudens; 02-05-2010 at 12:30 PM.
 
Old 02-05-2010, 12:58 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958Reputation: 1958
Searching for "restart" in apt turned up a few promising hits.

launchtool
monit
restartd

I haven't tried any of these myself.

A simple brute-force way is to run it in a loop.
Code:
while true; do command ; done
Any time the command terminates, for any reason, the loop will start it up again. The only way to get out of it is to crtl-c terminate the loop.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
program crashed, but why? themate Programming 9 09-03-2010 12:26 PM
X Server Crashed and Can't Restart [Vector 6] adamnew123456 Linux - Software 1 12-16-2009 09:23 PM
fedora linux 8 crashed 7 grub loader displaying after restart jbind_007 Linux - General 1 04-13-2009 01:08 AM
How do I stop a program that has crashed? Fe98 Linux - Newbie 4 12-08-2003 07:09 AM
How to kill program that has crashed? glock19 Linux - General 3 01-11-2002 01:49 PM


All times are GMT -5. The time now is 11:25 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration