Watch an application and restart it

1.2k views Asked by At

I'm using saltstack minion on Windows. I would like to always check if an application is started. Restarts if it crashes. And also add the possibility to stop it. The application is not a Windows service. But I would like to simulate the service with saltstack.

I've check the cmd.run but i'm not sure how to use it. It seems this command wait for the exit of my application. But I don't want to exit

Thank you.

1

There are 1 answers

0
Utah_Dave On BEST ANSWER

Salt only runs commands when you tell it to. You may want to use the service beacon if you want to constantly check the status of a service.

The service beacon will check once a second (or whatever interval you prefer) and send an event on Salt's event bus when the status changes.

Then you could make salt reactor that will start up the service that has gone down.

Beacon description here: http://docs.saltstack.com/en/latest/topics/beacons/

Service beacon description here: http://docs.saltstack.com/en/latest/ref/beacons/all/salt.beacons.service.html#module-salt.beacons.service