Originally posted in Config asking for help but i solved my own problem in the end.
I wrote a script in Autohotkey, that runs an MQTT Client on a Windows PC.
Source code included.
This is a project called winthing (not by me), compiled and wrapped in a script for easy settings
Original Github
This allows any .exe to run via direct JSON path name ie. [“C:\Program Files (x86)\Kodi\kodi.exe”]
Winthing can be unresponsive after some time, so my script has options in the settings.ini
Runmode and Runmode time
Runmode is used for restarting the service in case it fails
Runmodetime - Time in SECONDS before the service is restarted, service takes about 2 seconds to restart, suggested to keep this at about an hour
Runmode 1 - Will close the old service then start a new one
Runmode 2 - Will Start the new service then close the old one (crossover) this shortens the restart time but may result in double execution in rare cases
Runmode 3 - Off, this will not restart the service after any time
everything is included in the zip, all the details for winthing by msiedlarek are on his github, all i have done is compile it and used an autohotkey script to make it hidden, easier to put in the settings and now keep it alive if it fails.
Supported messages - https://github.com/msiedlarek/winthing/blob/master/README.md#supported-messages