HOWTO - LUA script to start/stop a service on many robots

Discussion created by pmatt on Oct 12, 2012
Latest reply on Oct 12, 2012 by pmatt

This was handy when our deployment server service stopped on 13 boxes. Replace the fields below with your own names, and fill srv_array with the relevant servers. There is no restart_service function for the ntservices probe. So just run the stop_service below, then change to start_service and run again.



args = pds.create()
pds.putString (args,"name","service name goes here")

domain = "domain goes here"
hub = "hub goes here"

srv_array = {"SERVER1","SERVER2","SERVER3"}

for i,robot in pairs(srv_array) do
  nim_address = "/"..domain.."/"..hub.."/"..robot.."/ntservices"
  nimbus.request (nim_address,"stop_service", args)