LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to start a process when it stops (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-start-a-process-when-it-stops-394484/)

Cipher01 12-19-2005 09:05 AM

How to start a process when it stops
 
I have a process running, but every few minutes it stops. Is there some way to make it start again automatically when it stops. Maybe by running it in the background? I have the process ID.

tuxrules 12-19-2005 09:14 AM

Quote:

Originally Posted by Cipher01
I have a process running, but every few minutes it stops. Is there some way to make it start again automatically when it stops. Maybe by running it in the background? I have the process ID.

What is the process? If the process is run by the kernel, you don't have to worry about it. If you are running the process and it terminates, you can start the program. Backgrounding won't do anything in this case. Backgrounding is done to detach the process from the shell so that you can continue to use the shell.

Tux,

camorri 12-19-2005 09:15 AM

You need to supply more information. What process is it that stops? Why is it stopping? Are there error messages? Have you looked in the logs for any insight to the problem?

buwaleed 12-19-2005 09:34 AM

crontab can be set to check if an application is running at a set time, but as previous posts stated .. more info needed :)

Cipher01 12-19-2005 04:46 PM

The program was made by my friend as a "game" for me. It's a word processor and he wants me to keep it from stopping or restart it immeditaly after it stops. I was hoping I could do the latter. The PID I know because when I ran it, I also used the "ps -A" command and found it running, on the process list it's called "Gwerd". That's about as much as I can tell you.

spx2 12-19-2005 06:14 PM

you can try doing something like this:
Code:

#!/bin/bash
until  ["1"]; do
. <path to your program>
done

and save it as autorun.sh
do
Code:

chmod +x autorun.sh
and then
run the script with bg autorun.sh

Cipher01 12-20-2005 08:39 AM

Yay! It worked. Thanks for your help.


All times are GMT -5. The time now is 06:45 AM.