Restart module in a Script or in Command Line

I have been having trouble with the MQTT Distributor module (v4.0.3) erroring out from too many connections even though I know I only have 10 total connections. The problem is fixed when the module is restarted (it resets the Client Connections’ tag back to the actual number of connections). So, while I fix the underlying problem, I need a way to automate restarting the module when the tag quality goes bad or when the Client Connections is approaching 50. I have experimented with hitting the URL to the confirm button in the gateway both with and the python webbrowser library. These work in an interactive scripting environment but are unavailable when running gateway/tag event scripts because they are actually opening a web browser. Is there a way to restart modules from the command line or from inside a script?


Did you get an answer on this? I am also looking to do this with communication timeouts and socket connection loss on dnp3.

I never did get an answer for this.

I found a solution using a frozen tag detection to automatically restart the driver. I take an integer sum of the critical tags and if the values become stale then I reboot the driver through a script using alarming to trigger the script and notify me by e-mail. So I have 2 tags (a “now” value of the tag list summation and a “then” value which is now minus 40 seconds) If they match for more than 2 minutes then I know I have a stale reading (in my case) and I use an alarm configuration to trigger this. I then use a Tag Event Script to reboot the driver:

print (“Rebooting Now!”)
drv = ‘Name of your Device’
system.device.setDeviceEnabled (drv, False)

I then set a driver reboot tag to true and wait 5 minutes to run this script:

system.device.setDeviceEnabled (drv, True)

On successful reboot I send another e-mail that the driver was recovered.