Specify Content for an Instruction-Based Package
After you complete the
prerequisites to create an instruction-based package and steps 1 through 6 of
Create a Package, do the following to specify the content for an instruction-based package:
1. On the Create Package page, select the Instruction-Based Package tab.
2. To select the type of instruction that you want to deliver to the asset. click Add Instruction.
3. From the Instruction Type list, select one of the following instructions and then complete the associated steps. Details for each instruction type are provided in the sections following this procedure.
4. If you want to add additional instructions, repeat step 3. You can add multiple instructions to a single instruction-based package.
5. Review the instructions in the instruction list, which provides the following details:
◦ Order—Specifies the order in which the instructions are executed on the agent.
◦ Type—Specifies the type of instruction.
◦ Details—Specifies the details of the instruction that you specified when creating the instruction.
Select an instruction from the list and use one of the following options to modify the instruction:
◦ To edit an instruction, click

.
◦ To reorder an instruction, click

or

.
|
|
Ensure that there is only one Restart instruction in the list and the Restart instruction is the last instruction.
|
◦ To delete an instruction, click

.
6. Click Save to save the package.
The following sections provide details for defining each of the instruction types:
Download
To select a file from the ThingWorx repository that you want to download to the agent, complete the following steps :
1. The
Target Repository field displays the configured target repository for the download. To change the target download repository, click

then click

.
2. The Directory Structure and Directory Content panes display the contents of the selected repository. Using these panes, navigate to the script file that you want to download to the asset.
The following information is available for each file in the Directory Content pane:
◦ Name—Specifies the name of the file with its extension. If the file was uploaded to the repository, the timestamp (in Epoch time) is appended to the file name. This timestamp distinguishes between two files with the same name.
◦ Upload Date—Specifies the date and time at which the file was added to the ThingWorx repository.
◦ Size—Specifies the size of the file in bytes.
◦ Path—Specifies the absolute path of the file in the ThingWorx repository.
3. In the Directory Content pane, select the script file to display its name in the Selected Content File Name field.
You can perform the following actions under the Directory Content section:
◦ If the file that you want to deliver to the asset is not available in the selected repository, click

to upload the file to the
ThingWorx repository.
◦ To delete the file from the repository, click

.
4. In the Destination Directory field, specify the location on the asset where you want to download the file.
5. If you provided an absolute path in the Destination Directory field, select the Destination directory is absolute checkbox.
6. If you want the asset to extract the file after it is downloaded, select the optional Agent should uncompress this file after downloading check box.
|
|
The eMessage agent can extract only those files that are in the tar.gz format.
To extract a file in any other format, add an Execute instruction to the package with an extraction executable.
|
7. If you want any existing files to be overwritten when the files are downloaded to the specified directory, select the optional Overwrite existing files when this file is downloaded to the given directory checkbox.
8. To add the instruction to the instruction list, click Add.
Execute
To define an Execute instruction, which executes a command on the Remote Thing, complete the following steps:
1. In the Executable field, enter the command that you want to execute.
2. In the Arguments field, specify the arguments of the command that you defined in the Executable field. This field is optional.
|
|
The command that is executed is the combination of the values of the Executable and Arguments fields.
|
3. If the path of the executable is absolute, select the Executable path is absolute checkbox.
4. If you want the commands to be asynchronous or independent of each other during execution, select the Execute this command asynchronously checkbox. The executions are synchronous by default.
5. To add the instruction to the instructions list, click Add.
Register Script
To add instructions as a script that can be deployed to one or more assets for an Axeda agent, complete the following steps. After registering a script, you can do the following:
• Validate the instruction you want to run against an asset or assets.
• Run the script multiple times against the same asset or assets using the script name you registered.
1. In the Script file field, enter the absolute path to the file that you want to register.
|
|
If you get validation errors, check for spaces entered as a prefix or suffix in the file path.
|
2. In the Script name field, enter the script name that you want to add as an instruction.
3. To add the instruction to the instruction list, click Add.
Restart
To define an instruction to restart the agent, complete the following steps:
1. To terminate the current agent process and start a new agent process, select the Hard Restart. Uncheck for a Soft Restart checkbox.
If you do not want to terminate the current agent process but reinitialize all the components and reload data from the disk, ensure that you clear the Hard Restart. Uncheck for a Soft Restart checkbox.
2. To add the instruction to the instruction list, click Add.
|
|
Ensure that the Restart instruction is the last instruction in the list of instructions.
|
Run Script
To define an instruction that runs a registered script that can be deployed for one or more assets for an Axeda agent, complete the following steps:
1. In the Script name field, enter the script name that you want to run.
2. To add the instruction to the instruction list, click Add.
Set Property
To define an instruction that sets a specified property value on the remote asset, complete the following steps:
1. In the Property Name and Property Value fields, specify the name and value of the property.
|
|
The property name is the Thing property name in ThingWorx Composer. The Thing property name must be mapped correctly to the remote property name for the Set Property instruction to work. The remote property name is sent to the asset.
If the Thing property is not configured as remote, or if the specified Thing property is missing, the deployment will be marked as ineligible.
|
2. To add the instruction to the instruction list, click Add.
Unregister Script
To define an instruction to unregister a script for one or more assets for an Axeda agent, complete the following steps:
1. In the Script name field, enter the script name that you want to unregister.
2. To add the instruction to the instruction list, click Add.
Upload
To define an instruction for Axeda eMessage agents to upload one or more files to the ThingWorx Platform, complete the following steps:
1. In the
Target Repository field, click

to select the repository to which you want to upload the files.
You can create a file repository specifically for uploads, for example, UploadRepository.
2. In the Target Path field, specify the location in the repository where you want to save the uploaded files.
For example, entering /UploadFiles saves the files to the /UploadRepository/UploadFiles directory.
If you enter / , the uploaded files are saved to the repository you defined in step 1.
|
|
The files are saved in a directory that is named after the Thing that uploaded the files. This directory is located under the value of the Target Repository or Target Path field.
For example, if the package is deployed to the MyThing Thing and the value of the Target Repository and Target Path field is /UploadRepository/UploadFiles, the file is uploaded to the /UploadRepository/UploadFiles/MyThing directory.
|
|
|
If the location specified in the Target Path field does not exist, the location is created under the Target Repository during deployment.
|
3. In the
File(s) to Upload field, enter the name of the file that you want to upload and click

. Ensure that this file exists in the relative path of your device.
If you want the file to be deleted from your repository after the package is successfully deployed, select the
Delete File After Upload checkbox before clicking

You can include wildcard entries such as * or ? in your file names. Use * to represent multiple characters and ? to represent a single character. For agents running on Windows, the ? character returns the same result as the * character.
4. The table under the File(s) to Upload field displays the list of files to be uploaded to the ThingWorx Platform along with their Delete File After Upload status. From this table, you can perform the following actions:
◦ If you want to remove a file from the list, select the entry in the list, and click Remove. To select all files, select the checkbox in the toolbar next to File Name.
◦ If you want to change the
Delete File After Upload status for a file, click

and select or clear the
Delete File After Upload checkbox as needed.
5. To add the instruction to the instruction list, click Add.