Introduction
In this example user want to poll for an incoming file on the ServerA, once file matching with reguler expression is found JobScheduler should transfer the file(s) from ServerA to ServerB.
After successfully transfer of file on ServerB, JobScheduler should start an processing script on ServerB via SSH.
Solution
For such a file transfer and processing workflow, JobScheduler has inbuilt JITL jobs, namely JADE job and SSH job.
Job Chain : FileTransferAndProcessing.job_chain.xml
The job chain FileTransferAndProcessing has two nodes/steps:
Step 1: jade_s2s_file_transfer.job.xml
Step 2: ssh_start_proccessing.job.xml
Job Chain : example
<?xml version="1.0" encoding="ISO-8859-1"?> <job_chain orders_recoverable="yes" visible="yes" title="Tranasfer Data from ServerA to ServerB and start Processing on ServerB vis SSH" max_orders="1" name="DataTransferProcessing"> <job_chain_node state="jade_s2s_file_transfer" job="jade_s2s_file_transfer" error_state="error" next_state="ssh_start_proccessing" on_error="suspend"/> <job_chain_node state="ssh_start_proccessing" job="ssh_start_proccessing" next_state="success" error_state="error" on_error="suspend"/> <job_chain_node state="success"/> <job_chain_node state="error"/> </job_chain>
Jade JITL Job : jade_s2s_file_transfer.job.xml
This job is an JITL job
<?xml versioh1. "1.0" encoding"ISO-8859-1"?>
<job titlh1. "S2S transfer with polling (API Job for JobScheduler Advanced Data Exchange)" order"yes" stop_on_erroh1. "no" name"jade_s2s_file_transfer">
<description > <include file="jobs/jadeJob.xml"/> </description>
<params > <param name="file_spec" value="\.log$"/>
<param name="operation" value="copy"/>
<param name="verbose" value="9"/>
<param name="poll_interval" value="30"/>
<param name="poll_minfiles" value="1"/>
<param name="poll_timeout" value="600"/>
<param name="source_protocol" value="ftp"/>
<param name="source_host" value="mp.sos"/>
<param name="source_user" value="test"/>
<param name="source_password" value="test"/>
<param name="source_dir" value="/outbound"/>
<param name="target_protocol" value="sftp"/>
<param name="target_host" value="homer.sos"/>
<param name="target_user" value="test"/>
<param name="target_password" value="12345"/>
<param name="target_ssh_auth_method" value="password"/>
<param name="target_dir" value="/home/test/inbound"/> </params>
<script language="java" java_class="sos.scheduler.jade.JadeJob"/>
<run_time />
</job>
SSH JITL Job : ssh_start_proccessing.job.xml
<?xml version="1.0" encoding="ISO-8859-1"?> <job title="Launch commands or executable files by SSH" order="yes" name="ssh_start_proccessing"> <description > <include file="jobs/SOSSSHJob2JSAdapter.xml"/> </description> <params > <param name="host" value="homer.sos"/> <param name="port" value="22"/> <param name="user" value="test"/> <param name="auth_method" value="password"/> <param name="command" value="uname -an"/> <param name="password" value="12345"/> </params> <script language="java" java_class="sos.scheduler.job.SOSSSHJob2JSAdapter"/> <run_time /> </job>