Table of Contents

About

Sometimes you may want to restart Corrade manually and that can be done via the execute Corrade command by telling the operating system to restart Corrade. On Windows, Corrade can run as a service and, if you run Corrade as a service, then it is fairly easy to write an LSL script to restart the Corrade service from within the grid. The following is an LSL script contributed by JP Bluebird from Bluebird Designs and will allow you to manually restart Corrade's service by using the "Execute" command and PowerShell.

Requirements

Code

manual_corrade_restart.lsl
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// CONFIGURATION
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
string CORRADE  = "00000000-0000-0000-0000-000000000000"; // The UUID / Key of the scripted agent.
string GROUP    = "My Group";                             // Bot's Group Name as defined in the ini File
string PASSWORD = "mypassword";                           // Bot's Password as defined in the ini File
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// END CONFIGURATION
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
string wasKeyValueEncode(list kvp)
{
  if(llGetListLength(kvp) < 2) return "";
  string k = llList2String(kvp, 0);
  kvp = llDeleteSubList(kvp, 0, 0);
  string v = llList2String(kvp, 0);
  kvp = llDeleteSubList(kvp, 0, 0);
  if(llGetListLength(kvp) < 2) return k + "=" + v;
  return k + "=" + v + "&" + wasKeyValueEncode(kvp);
}
 
default
{
  touch_start(integer num)
  {
    llInstantMessage(CORRADE, wasKeyValueEncode([
      "command",   "execute",
      "group",     llEscapeURL(GROUP),
      "password",  llEscapeURL(PASSWORD),
      "file",      "Powershell",
      "parameter", "Restart-Service Corrade"
    ]));
  }
}
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Contributed by JP Bluebird (Bluebird Designs)
/////////////////////////////////////////////////////////////////////////////////////////////////////////////