Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To use the return-values-feature configure a SSH job with JOE and choose SOSSSHJob2JSAdapter

Example 1: minimum configuration of a SSH Job

Code Block
languagexml
collapsetrue
<?xml version="1.0" encoding="ISO-8859-1"?>
<job title="Launch remote commands or executable files by SSH" stop_on_error="no">
    <description >
        <include  file="jobs/JobSchedulerSSHJob.xml"/>
    </description>
    <params >
        <param  name="host" value="HOSTNAME"/>
        <param  name="port" value="22"/>
        <param  name="user" value="USERNAME"/>
        <param  name="password" value="PASSWORD"/>
        <param  name="auth_method" value="password"/>
        <param  name="command" value="printenv"/>
    </params>
    <script  language="java" java_class="sos.scheduler.job.SOSSSHJob2JSAdapter"/>
    <run_time />
</job>

Example 2: Jobchain processing return values

Code Block
languagexml
titleOrder Job storing a key/value pair on the remote host
collapsetrue
<?xml version="1.0" encoding="ISO-8859-1"?>
<job name="setValueRemote" title="Launch remote commands or executable files by SSH" order="yes" stop_on_error="no">
    <description >
        <include  file="jobs/JobSchedulerSSHJob.xml"/>
    </description>
    <params >
        <param  name="host" value="HOSTNAME"/>
        <param  name="port" value="22"/>
        <param  name="user" value="USERNAME"/>
        <param  name="password" value="PASSWORD"/>
        <param  name="auth_method" value="password"/>
        <param  name="command" value="echo ADD='Hallo Welt' &gt;&gt; \$SCHEDULER_RETURN_VALUES"/>
    </params>
    <script  language="java" java_class="sos.scheduler.job.SOSSSHJob2JSAdapter"/>
    <run_time />
</job>
Code Block
languagexml
titleOrder job reading the returned value(s)
collapsetrue
<?xml version="1.0" encoding="ISO-8859-1"?>
<job  order="yes" name="getValue">
    <params />
    <script  language="shell">
        <![CDATA[echo %SCHEDULER_PARAM_ADD%]]>
    </script>
    <run_time />
</job>

Code Block
languagexml
titleJobchain to write value(s) remote and read the returned Scheduler parameters
collapsetrue
<?xml version="1.0" encoding="ISO-8859-1"?>
<job_chain  name="test_return_values">
    <job_chain_node  state="WRITE_VALUE_REMOTE" job="setValueRemote" next_state="READ_VALUE" error_state="ERROR"/>
    <job_chain_node  state="READ_VALUE" job="getValue" next_state="SUCCESS" error_state="ERROR"/>
    <job_chain_node  state="SUCCESS"/>
    <job_chain_node  state="ERROR"/>
</job_chain>

 

For known limitations using the SSH Job to connect to a Windows Remote Host see Limitations when using SSH jobs for Windows.

...

Note

Make sure to add the BouncyCastleProvider as the second Provider and adjust the numeration.

  • If you add the Provider as the first, the default Java JCE can be broken.
  • If you add the Provider as the last one, it can happen that Java doesn´t recognizes it.

...