How to execute a script as post execution of dtscli command ?

book

Article ID: 220740

calendar_today

Updated On:

Products

CA Client Automation CA Client Automation - IT Client Manager

Issue/Introduction

How to execute a script as post execution of dtscli command ?

Environment

Client Automation 14.0 All Versions

Resolution

EXTERNAL file filter could be used to execute a script on responder.
 
Some example of commands :
 
dtscli -a "ipath=/tmp/test1" "rpath=/tmp/test2" "p_filters=binary" "f_filters =:EXTERNAL(PATH=</tmp/test.sh> TIMEOUT=<15>)

dtscli -a "ipath=Computer1::c:\temp\test.log" "rpath=Computer2::c:\temp\test.log" "p_filters=binary" "f_filters= :EXTERNAL(PATH=<cam_restart.bat>)"
 
 
Here is an example of usage :
- On responder machine (JY-W2K16-14SP3) I create a directory C:\TEMP\DTSScript with the script file dtsscript_responder.bat containing these lines :
 
@echo off
echo %DATE%-%TIME% - Execution of %0 %1 %2 %3 %4 %5 %6 >> c:\temp\dtsscript\dtsscript_responder.log
 
IF EXIST c:\temp\dtsscript\file.bat del /F /Q c:\temp\dtsscript\file.bat
ren c:\temp\dtsscript\file.txt file.bat
 
 
 
- On Initiator machine (JY-W10-SS), execute the first dtscli command which is doing the transfer files.
dtscli -a "ipath=JY-W10-SS::C:\TEMP\DTSScript\file.txt" "rpath=JY-W2K16-14SP3::C:\TEMP\DTSScript\file.txt" "p_filters=binary" "iuser=JY::pwd1" "ruser=Administrator::pwd2"
 
 
Next execute the second dtscli command to execute the script dtsscript_responder.bat on responder via an file External filter.
dtscli -a "ipath=JY-W10-SS::C:\TEMP\DTSScript\test.txt" "rpath=JY-W2K16-14SP3::C:\TEMP\DTSScript\test.txt" "p_filters=binary" "f_filters=:EXTERNAL(PATH=<C:\TEMP\DTSScript\dtsscript_responder.bat> PARMS=<param1,param2>)" "iuser=JY::pwd1" "ruser=Administrator::pwd2"
 
 
Remarks :
  •  If DTS Security Mode is set to quiet on initiator and responder, iuser and ruser parameters are not needed.
  • File C:\TEMP\DTSScript\test.txt is not important, it is only used to start the script. It is not mandatory that it is present on initiator and it is not created on responder.
 
 
On reponder machine following files are present after execution of both dtscli commands :
 
image.png
 
 
File file.txt has been copied with first dtscli command.
Second dtscli command has executed dtsscript_responder.bat and fichier file.txt has been renamed as file.bat
 
 
File c:\temp\dtsscript\dtsscript_responder.log contains this :
 
Fri 07/30/2021-16:11:43.44 - Execution of C:\TEMP\DTSScript\dtsscript_responder.bat "C:\Program Files (x86)\CA\DSM\dts\dta\staging\2ao824o\1gg824v0.dts" "C:\TEMP\DTSScript\test2.txt" param1 param2   
 
Parameters %1 and %2 are automatically added by dtscli.
Parameters provided by PARMS are set starting %3
 
PARMS=<param1,param2>
 
%3=param1
%4=param2