Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: dspence on May 08, 2020, 11:45:34 AM

Title: Process supervision
Post by: dspence on May 08, 2020, 11:45:34 AM
Hi all,

I'm using Tiny Core 8.  I have a program that needs to automatically be restarted if it crashes or quits.  What is the best way to achieve that?  Is there an extension that will do this for me, or something already installed in the core?

Thanks!
Title: Re: Process supervision
Post by: GNUser on May 08, 2020, 11:59:45 AM
As long as your program is not a daemon that automatically puts itself in the background, here is a simple solution:
Code: [Select]
#!/bin/sh
while true; do
    your-program
done

The script starts your-program and waits; anytime your-program stops running for any reason, the script starts your-program and waits :)
Title: Re: Process supervision
Post by: dspence on May 08, 2020, 12:51:02 PM
Wow!  GNUser, that is perfect!  And so simple!  Thank you very much!! :)