Make sure application is always running? Windows


#1

I’ve seen this chapter from ofBook but it is not exactly what I need.

I need the OpenGL application to behave as a Windows service, windows services have two basic properties:

  • Launched when computer boots
  • Restarted if the program crashes

The first one is simple to accomplish, but for the second one I’m struggling. I could make another application that monitors my ofApp, and restarts it if it’s closed. But what if this secondary application also crashes?


#2

I don’t know if its helpful, but on osx / linux ofxWatchdog does a really good job of this – it’s a separate thread I think :


#3

Will see if it’s windows friendly, but it doesn’t seem to be.

Thanks!


#4

no I don’t think it’s windows friendly – just that this approach seems to work well and wonder if you can find a windows equivalent.


#5

I know a well know and expensive windows based media server uses 2x watchdog apps that watch each other and the media server. They sell their stuff on reliability so this may be a good solution.

There are also some commercial applications that do this.


#6

Two watchdogs doesn’t sound bad actually, chances of everything crashing at once are smaller. Thanks!


#7

You can use windows task scheduler to add app to startup:

You can create an app which will run on startup, and then run your primary app.
This app can monitor activity of your primary app, and in case if your app is not responding - kill all services with the same name as your primary app and then restart app or computer.

You can detect if primary app is healthy by sending pulse message to watch app every second, or using system commands you can check if the service with that name is still running.