Running the Lua Script Resource
The Lua Script Resource can be run either from a command line or as a service to host things on the remote device.
Running from a Command Line
To run the Lua Script Resource from a command line, follow these steps:
1. Open a command window or terminal session on the system or device that is hosting the Lua Script Resource.
2. Change to the \microServer\etc\ directory.
3. Copy and rename the config.lua.example file to config.lua.
5. Change directories back to the to the top level \microserver directory.
6. Enter the luaScriptResource command to run the Lua Script Resource executable. To include a specific configuration file, use a command similar to the following:
luaScriptResource -cfg .\etc\config.lua
|
If no configuration file is specified, the default file, etc\config.lua, is used.
|
This command causes the Lua Script Resource to start listening on port 8001, if the default values are used.
7. To access the interface of the extension, open a browser and enter the following address to view a list of executing scripts:
http://localhost:8001/scripts
8. Should you need to shut down the Lua Script Resource, press ENTER to display the console prompt and type q.
Running as a Service
To run the Lua Script Resource as a Windows service, follow these steps:
1. Open a command window or terminal session on the system or device that is hosting the Lua Script Resource.
2. Change to the \microServer\etc directory.
3. Copy and rename the config.lua.example file to config.lua.
5. Run the following command:
C:\microserver\luaScriptResource.exe -cfg "C:\microserver\etc\config.lua" -i "ThingWorx Script Resource"
Where:
cfg
|
Specifies the full path to the location of the configuration file.
|
i
|
Specifies the name to be used for the installed service.
|
|
Run the luaScriptResource executable and the reference to the configuration file using the full path (even if it is running from the directory where the luaScriptResource.exe file is located).
Due to space constraints, the command shown above has the second argument/value pair on a second line. Do NOT just copy and paste this command without removing the extra line break and spaces.
|
6. Should you need to uninstall the service, run the following command:
C:\microserver\luaScriptResource -u "ThingWorx Script Resource"
Where:
u
|
Specifies the name of the service to be un-installed. This name must exactly match the name that you assigned to the Lua Script Resource service.
|