Redwood Documentation

Product Documentation

 

›Command Line Tools

RunMyJobsPlatform Agents

External Platforms

  • Connecting Redwood Server to External Platforms

Credentials

  • Storing Credentials
  • Credential Protocols

Platform Process Servers

  • On-site Platform Process Servers
  • Cloud Platform Agents
  • Using the Wizard to Create Process Servers
  • Configuring Platform Agents
  • Spool Host Agents
  • The Environment of Platform Agent OS Processes
  • Processing Platform Processes
  • Process Server Services
  • Configuring Agentless Process Servers
  • Automatically Updating Platform Agents
  • Enabling TLS
  • Creating Monitoring Checks
  • Configuring Load Balancing on Platform Agents
  • Platform Agent Registry Entries
  • Monitoring Servers with Platform Process Servers

UNIX Agents

  • UNIX Process Servers
  • UNIX Process Server Configuration Data
  • File Events on UNIX
  • Creating UNIX Process Servers (Advanced)
  • Choosing a User Switching Security Mode
  • Controlling Unix Platform Agents
  • Uninstalling Redwood Server Platform Agents from UNIX

Windows Agents

  • Creating a Microsoft Windows Process Server
  • File Events on Microsoft Windows Process Servers
  • Configuration of a Microsoft Windows Process Server
  • Managed Services
  • Configuring Platform Agents on Microsoft Windows
  • Automating Windows tasks that require a desktop window
  • Uninstalling Redwood Server from Microsoft Windows

Agent Definition Types

  • Using the BASH Definition Type
  • Using the KSH Definition Type
  • Using the CSH Definition Type
  • Using the Perl Definition Type
  • Using the Python Definition Type
  • Using the PowerShell Definition Type
  • Using the Visual Basic Script Definition Type
  • Using the CMD Definition Type
  • Using the R Process Definition Type
  • Using the DCL Definition Type
  • Using Platform Definition Types
  • Using the OS Native Definition Type
  • Microsoft Windows Definition Types
  • Using the SQLPLUS Definition Type
  • Using the FTP Definition Type
  • Using the Groovy Definition Type

Command Line Tools

  • Command Line System Tools
  • jtool
  • jcat
  • jdescription
  • jevent
  • jecho
  • jftp
  • JFTP Return Codes
  • jgetcredential
  • jgetfile
  • jgetpar
  • jjoin
  • jlink
  • jlog
  • jmail
  • jmessage
  • jmonitor
  • jputfile
  • jregister
  • jrfc
  • jscp
  • jtool screenshot
  • jscript
  • jsecret
  • jsleep
  • jsplit
  • api-tool.jar

OpenVMS Process Servers

  • Creating HP OpenVMS Process Servers
  • Installing the Platform Agent on HP OpenVMS
  • Configuring HP OpenVMS Process Servers
  • File Events on HP OpenVMS
  • HP OpenVMS Definition Types

AS/400 Connector

  • IBM AS/400 Connector Architecture
  • Setting up the IBM AS/400 Connector
  • Creating an IBM AS/400 Process Server
  • Files on AS/400 Raise Events
  • Using the AS/400 Definition Type
  • Redwood Server OS Support
  • IBM z/OS Definition Types
  • Using the JCL_FTP Definition Type
  • IBM z/OS System Tools

Reference

  • Balancing the Load
  • Credential Protocols
← jsplitCreating HP OpenVMS Process Servers →

api-tool.jar

This tool is used to run scripts and raise events from systems for which there are no command-line system tools. You download it from Configuration > Software, under the API Downloads section. The script files, which must contain RedwoodScript, should be available to the api-tool. Depending on the platform where you run the api-tool on, you might not be able to create the connection files. Use the jsecret command on a supported platform to create the connection file and copy it over to the system where you want to use the api-tool.

Setting the Return Code

The jcsShell.setReturnCode(int) method is used to set the return code of the script. You throw an exception if you want to terminate processing; the last effective call to jcsShell.setReturnCode() will set the return code.

Prerequisites

  • Java 1.8 or higher JVM
    • Unlimited strength Java Cryptography Extension (JCE) if your server uses TLS and/or SSL.
    • TLS options can be set using JVM specific system properties.

Syntax

java -jar api-tool.jar <command> [command-specific-arguments]

<command>:
event <connectionFile> <eventName> [raiseComment] -  Raise event <eventName> with optional comment [raiseComment]
script <connectionFile> <scriptFile> -  Run script in <scriptFile>
import <connectionFile> <file> [-targetpartition <Partition>] [<ImportRuleSet>]
version - Print the version
  -noverify           Skip server certificate verification
  -cipherlist <list>  Override the default cipherlist

Development

Simple Program

Usage javac -cp api-tool.jar <class.java>

Example

The file PrintJobDefinitions.java contains the following:

import com.redwood.scheduler.api.tool.*;

public class PrintJobDefinitions
{
  public static void main(String [] args)
  throws Exception
  {
    ToolConnection tConnection = ToolConnectionFactory.createConnection(args[0], 60000);
    ToolResultSet rs = tConnection.executeQuery("select JobDefinition.Name, JobDefinition.UniqueId from JobDefinition", null, null);
    while (rs.next())
    {
      System.out.println(rs.getString(1) + " = " + rs.getString(2));
    }
  }
}

Compile & run it:

$ javac -cp api-tool.jar PrintJobDefinitions.java
$ java -cp api-tool.jar:. PrintJobDefinitions net/connect.rw

Upload CAR & JAR Files

import com.redwood.scheduler.api.tool.ToolConnection;
import com.redwood.scheduler.api.tool.ToolConnectionFactory;
import java.io.File;
import java.util.Collection;
import java.util.Map;

public class Uploader
{
  public static void main(String [] args)
  throws Exception
  {
    if (args.length > 1)
    {
      ToolConnection tConnection = ToolConnectionFactory.createConnection(args[0], 60000);

      if (args[1].toLowerCase().endsWith("car"))
      {
        System.out.println("Uploading CAR file");
        String importSet = "";
        if(args.length == 3)
        {
          importSet = args[2];
        }
        Map mp = tConnection.uploadCAR(new File(args[1]), importSet);

        if (mp.size() > 0)
        {
          Collection cl = mp.values();
          System.out.println("JobId: "+cl.iterator().next());
        }
      }
      else if (args[1].toLowerCase().endsWith("jar")&& args.length == 3)
      {
        System.out.println("Uploading JAR file");
        Map mp = tConnection.uploadJAR(new File(args[1]), args[2]);

        if (mp.size() > 0)
        {
          Collection cl = mp.values();
          System.out.println("JobId: "+cl.iterator().next());
        }
      }
      else
      {
        System.out.println("Invalid Arguments.");
        System.out.println("Usage: Main <connection_file> <car_file> [<importRuleSet>]");
        System.out.println("       Main <connection_file> <jar_file> <library>");
      }

    }
    else
    {
      System.out.println("Invalid Arguments.");
      System.out.println("Usage: Main <connection_file> <car_file> [<importRuleSet>]");
      System.out.println("       Main <connection_file> <jar_file> <library>");
    }
  }
}

Compile & run it:

$ javac -cp api-tool.jar Uploader.java
$ java -cp api-tool.jar:. Uploader
Invalid Arguments.
Usage: Uploader <connection_file> <car_file> [<importRuleSet>]
       Uploader <connection_file> <jar_file> <library>
$ java -cp api-tool.jar:. Uploader net/connect.rw /tmp/JobDefinition_RS_MSLN_DB_Backup.car
$ java -cp api-tool.jar:. Uploader net/connect.rw /tmp/myJar.jar Custom_Example

Example

In the following examples, the connection file created with jsecret -c is stored in net/connect.rw.

Submit a Process

The script script.rw used in these examples contains the following:

{
// code to submit a process running System_Sleep
// get the process definition (technical name 'job definition')
JobDefinition aDefinition  = jcsSession.getJobDefinitionByName("System_Sleep");

// create the process from the process definition
Job process = aDefinition.prepare();

// submit the process definition and write unsaved data to the database
jcsSession.persist();
}

Run a RedwoodScript

Run a script named script.rw:

java -jar /opt/tools/api-tool.jar script net/connect.rw script.rw

Raise an Event

Raise the event ETL_Complete

java -jar /opt/tools/api-tool.jar event net/connect.rw "ETL_Complete"  "ETL completed, please proceed with the next step"

Import a CAR File

java -jar apit-tool.jar import net/connect.rw JobDefinition_Test.car

See Also

  • RedwoodScript
  • jsecret
← jsplitCreating HP OpenVMS Process Servers →
  • Prerequisites
  • Syntax
  • Development
    • Simple Program
    • Example
    • Upload CAR & JAR Files
  • Example
    • Submit a Process
    • Run a RedwoodScript
    • Raise an Event
    • Import a CAR File
  • See Also
Docs
Getting StartedInstallationFinance InstallationConcepts
TroubleshootingArchiving
Learn and Connect
Support Portal
BlogEventsResources
ISO/ IEC 27001 Information Security Management
Automate to be human

2023 All Rights Reserved |

Terms of Service | Policies | Cookies | Glossary | Third-party Software | Contact | Copyright | Impressum |