Skip to main content
15-Moonstone
April 7, 2023
Solved

Question about Metadata for File Transfer Jobs

  • April 7, 2023
  • 3 replies
  • 1344 views

Hi,

 

I tried to deploy a batch file to a IoT device running Windows and expected it to be executed after downloaded, but the feature seems to not work (downloaded but not be executed)

 

Thingworx 8.5.19, WSEMS 5.3.2.1693

 

 

POST {{serverURI}}/Subsystems/FileTransferSubsystem/Services/Copy

{ 
 "sourceRepo": "FileRepo",
 "sourceFile": "backup.cmd",
 "sourcePath": "/scripts",
 "targetRepo": "IPU_1323212",
 "targetPath": "/Tmp",
 "targetFile": "backup.cmd",
 "timeout": 120000,
 "async": false,
 "queueable": false,
 "metadata": {
		"download": {
			"executeAfterDownload": true
		}
	}
}

 

 

 

Any ideas would be much appreciated!

 

Best Regards,

Hung Tran

Best answer by billrei

executeAfterDownload is an Axeda agent feature which is being exposed through the metadata parameter of the FileTransferSubsystem which implements the Copy. Metadata is just a payload without meaning unless your agent knows to look for some field inside the metadata block.

Here are the features than an Axeda agent supports in the metadata block, note that the EMS does not support any of these.

http://support.ptc.com/help/thingworx_hc/axeda_compatibility_package/en/index.html#page/axeda_compatibility_package/emessage_cx_server/c_emessage_connector_file_xfers_upload_state.html 

 

You should follow the advice in this KB article https://www.ptc.com/en/support/article/CS351449 and subscribe to file transfer events. When your file transfer completes, your agent can use this event to call code to execute your downloaded script, perhaps using lua's os.execute() command.

 

Depending on how often you are planning on doing this kind of thing, you might consider using the EMS's implementation of Thingworx Software Content (SCM) Management  http://support.ptc.com/help/thingworx/edge_microserver/en/index.html#page/c_sdk/c_ems_wsems_scm_setup.html This service suite, combined with a Thingworx platform extension and Mashup will manage the download and execution of files based on schedules and verify their successful execution.

3 replies

Community Manager
April 21, 2023

Hi @htran-21.

 

We're taking a look at this and will let you know if we have any questions.

 

Regards.

 

--Sharon

billrei12-AmethystAnswer
12-Amethyst
June 9, 2023

executeAfterDownload is an Axeda agent feature which is being exposed through the metadata parameter of the FileTransferSubsystem which implements the Copy. Metadata is just a payload without meaning unless your agent knows to look for some field inside the metadata block.

Here are the features than an Axeda agent supports in the metadata block, note that the EMS does not support any of these.

http://support.ptc.com/help/thingworx_hc/axeda_compatibility_package/en/index.html#page/axeda_compatibility_package/emessage_cx_server/c_emessage_connector_file_xfers_upload_state.html 

 

You should follow the advice in this KB article https://www.ptc.com/en/support/article/CS351449 and subscribe to file transfer events. When your file transfer completes, your agent can use this event to call code to execute your downloaded script, perhaps using lua's os.execute() command.

 

Depending on how often you are planning on doing this kind of thing, you might consider using the EMS's implementation of Thingworx Software Content (SCM) Management  http://support.ptc.com/help/thingworx/edge_microserver/en/index.html#page/c_sdk/c_ems_wsems_scm_setup.html This service suite, combined with a Thingworx platform extension and Mashup will manage the download and execution of files based on schedules and verify their successful execution.

Community Manager
June 21, 2023

Hi @htran-21.

 

I have marked the solution to your post.  If you disagree that it is the solution, please let me know.

 

Regards.

 

--Sharon