WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Process supervision  (Read 174 times)

Offline dspence

  • Newbie
  • *
  • Posts: 24
Process supervision
« 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!

Offline GNUser

  • Hero Member
  • *****
  • Posts: 566
Re: Process supervision
« Reply #1 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 :)
« Last Edit: May 08, 2020, 12:06:45 PM by GNUser »

Offline dspence

  • Newbie
  • *
  • Posts: 24
Re: Process supervision
« Reply #2 on: May 08, 2020, 12:51:02 PM »
Wow!  GNUser, that is perfect!  And so simple!  Thank you very much!! :)