WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Process supervision  (Read 1409 times)

Offline dspence

  • Newbie
  • *
  • Posts: 25
Process supervision
« on: May 08, 2020, 02:45:34 PM »
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

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 1509
Re: Process supervision
« Reply #1 on: May 08, 2020, 02:59:45 PM »
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, 03:06:45 PM by GNUser »

Offline dspence

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