AE JIL to copy file from one server to another

Document ID : KB000106309
Last Modified Date : 13/07/2018
Show Technical Document Details
Question:
Need to copy a file from one server to another. Can you provide an example of a JIL file to define a job to perform accomplish this task?
Answer:
You can reference https://docops.ca.com/ca-workload-automation-ae/11-4-2/en/reference/ae-job-information-language/jil-job-definitions for details on the various requirements and additional options to use in when defining jobs in JIL format. 

Assumption: 
  1. Using the UNIX/Linux secure copy command to transfer the file.
  2. All required configuration is in place to allow the specified user to transfer the files without prompt for password.
You can copy the file from one server to another through various ways. Below are two examples of job definitions in JIL format:

Example 1: JIL to issue Secure Copy command from one server to another 
insert_job: copy_file_job   job_type: CMD  
command: scp /home/autosys/data.csv autosys@DESTINATION_HOSTNAME:/home/autosys/ 
machine: <HOSTNAME of the source server> 
owner: autosys 
permission:  
date_conditions: 0  
alarm_if_fail: 1  

Example 2: JIL calling a script to secure copy file from one server to another 
insert_job: copy_file_job   job_type: CMD  
command: /home/autosys/scripts/copyfile.sh 
machine: <HOSTNAME where script resides> 
owner: autosys 
permission:  
date_conditions: 0  
alarm_if_fail: 1