Use standard and custom commands
You can use IIoT Core Services to run commands remotely on your geographically dispersed gateway devices.
You can use standard commands for common operations or create custom commands to add customized functionality.
Start a task
You can run a standard or a custom command on your gateway from IIoT Core Services by initiating a task.
Procedure
In the IIoT Core Services UI, select the Device tab, then Devices.
For a given device, click the Task button.
In the Start Task window, open the Select Command list to select a command.
Custom commands are prefixed with the word Custom.Make the necessary parameter selections in the Environment Variables section.These are the available standard commands:Standard commands Description reboot Reboot the gateway device. network information Get network information, including firewall and port information. device info Get device information for the gateway device, including number of core devices, memory, and disk size. resource usage View usage of computing resources (CPU, memory, disk space). get firewall rules Show the current firewall rules in the gateway. add port to firewall rules Enable a port to accept traffic to the gateway. This command is useful when you want to load and run your own container with an application that requires a port to be open on the gateway. NoteAn open port may expose the gateway to cyber exploits or attacks. Follow network security best practices or consult your IT security administrator before using this command.remove port from firewall rules Disable traffic to a specified port on the gateway. Use this command to reverse the Add port to firewall rules command when the corresponding container application is no longer needed. This command helps reduce the security risk. list containers List all running containers. purge container volume Clean up data in the container volume on the gateway. Click Confirm.
Results
Delete a task
You can use IIoT Core Services to delete a task from the Task list.
Procedure
In the IIoT Core Services UI, select the Device tab, then Tasks.
To delete a task, select the Actions menu (
), then Delete.
Select Delete to confirm deletion of the task or Cancel to keep the task.
Results
View tasks and task status
You can view current tasks running on a gateway device along with their status in the IIoT Core Services UI.
The task status overview is found on the Tasks sub-tab of the Device tab. The task status is found in the Status column.
The following table lists the available tasks statuses.
Task status | Description |
Queued | A task is placed in a queue when a condition, such as a lost connection, is preventing the task from being transmitted to the gateway device. |
Running | The task is running and active. |
Success | The task has successfully completed. |
Failed | The task encountered an error and did not complete. Restart the task. |
Canceled | The task has been cancelled while in Queued and Running state. |
Click the task to view the task output, which is the output produced on the gateway device.
Create a custom command
You can create a custom command in IIoT Core Services by writing a Shell script or by uploading a file that runs the needed functionality.
Procedure
In the IIoT Core Services UI, select the Device tab, then Commands.
Click the + Add button.
Complete the needed information on the Create Command page.
Field Description Name Enter a descriptive name for the custom command. This name appears in the Select Task list when you start a command. Version (Optional) Specify a version number of your choice to track the command version. Description (Optional) Provide a convenient description, such as the purpose of the command. Timeout Seconds Specify how long the command should try to execute before canceling the attempt. Type (Optional) Specify the runtime (Shell, Python, or custom).
If you select a custom type, click the Container Image Type list to select from available images in the software repository.
NoteMake sure the image has been pushed to the Docker Trusted Registry beforehand.(Optional) Add environment values if needed by clicking the + Add button.
Field Description Key Names Name of a parameter to appear in the Environment Variables area of the Start Task window.
Example: Set Start Time
Default Value Default value for the new parameter.
Description Helpful information about the command, such as the purpose of the parameter.
In the Upload window, upload a container application, either by using drag-and-drop or by browsing to select the file.
The file name appears in the list right above the Upload window along with other options.Under File Path, specify the file path of the container application.
In the Entry Point Shell Script window, enter the shell commands needed to launch the container that you are attaching.
Click Save.
Results
Edit a custom command
You can edit a custom command in the Commands inventory in IIoT Core Services.
Procedure
In the IIoT Core Services UI, select the Device tab, then the Commands tab.
To edit a custom command, select Edit from the Actions menu (
) for that command.
Make the necessary edits.
Click Save.
Results
Delete a custom command
You can delete a custom command from the Commands inventory in IIoT Core Services.
Procedure
In the IIoT Core Services UI, select the Device tab, then the Commands tab.
To delete a custom command, select Delete from the Actions menu (
) for that command.
Confirm the deletion by clicking Delete, or click Cancel to keep the command in the inventory.
Results