cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

Question about Metadata for File Transfer Jobs

htran-21
15-Moonstone

Question about Metadata for File Transfer Jobs

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

1 ACCEPTED SOLUTION

Accepted Solutions
billrei
5-Regular Member
(To:htran-21)

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.

View solution in original post

3 REPLIES 3
slangley
23-Emerald II
(To:htran-21)

Hi @htran-21.

 

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

 

Regards.

 

--Sharon

billrei
5-Regular Member
(To:htran-21)

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.

slangley
23-Emerald II
(To:htran-21)

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

Top Tags