Redwood Documentation

Product Documentation

 

›Agent Definition Types

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
← Using the BASH Definition TypeUsing the CSH Definition Type →

Using the KSH Definition Type

The Korn shell is the default UNIX shell on various UNIX systems such as AIX, HP-UX and Solaris. It is also available for Linux and Microsoft Windows in the form of pdksh.

note

You must assign at least one process server to run KSH process definitions in order to use the definition type.

Interpreter

By default, the interpreter for KSH scripts defaults to /bin/ksh on most platforms. You can override this by specifying an interpreter on process server-level with the LocalInterpreter_KSHprocess server parameter, for example, /usr/local/bin/pdksh. You can also specify a list of allowed interpreters on process server-level using the InterpreterWhitelist_KSHprocess server parameter and override the default interpreter on process definition-level with the parameter JCS_INTERPRETER_KSH. Simply create the parameter and point it to your preferred interpreter, it must exist and be white-listed using the InterpreterWhitelist_KSH process server parameter.

The InterpreterWhitelist_KSH process server parameter takes a regular expression that must match the value of the JCS_INTERPRETER_KSH parameter.

Writing portable KSH scripts

KSH is not the same implementation on all platforms. We have found the following compatibility issues between these variations:

  • Some versions of KSH do not support aliases in non-interactive invocations of the Korn shell. In other implementations, aliases can only be used in scripts that are not sourced, but executed. Since the process definition script code is sourced, it cannot call any aliases. We highly recommend that you use functions instead.
  • On Solaris, the syntax $(command) to execute a program and substitute its standard output is not allowed. You should use a pair of backtiocks (grave accents) to remain portable to Solaris: ``command.
  • The pdksh does not implement all the features of AT&T ksh so there are minor differences between the two.
  • The AT&T Korn shell has been released with an Eclipse Public License and the source code is freely available on github. This means that most major Linux distributions can now offer AT&T's Korn shell. If you have an older Solaris or Linux system, you might consider building and deploying it.

Environment

See Using Platform Definition Types for more information regarding the predefined variables and how to create per-system or per-user environment variables.

In addition, the KSH definition type will source ${JCS_HOME}/admin/ksh.profile if it exists, for backwards compatibility with v7. You can set JCS_HOME with the EnvironmentFile or EnvironmentVariables mechanism documented in Using Platform Definition Types.

Variables and Parameters

  • Parameters in the process definition are manipulated in the KSH source simply as variables, using the standard $VARIABLE syntax.
  • The Korn shell does not have actual data types; all parameter values are stored as strings. Numbers are translated automatically. Dates are sent and retrieved using the Script Date Format.
  • Out parameters are supported by setting the parameter using the VARIABLE=VALUE syntax.
  • Array parameters are supported for KSH, provided your interpreter supports them

Returning an Error

If your script code exits with a non-zero exit code this is correctly reflected in the server.

Code a set -e command to abort script execution immediately on running a command that has a non-zero exit status.

KSH Examples

The following shows how to use a normal environment variable:

echo "This is running under user $USER with home directory $HOME and temporary directory $TMPDIR."

The following shows how to pass numeric (N1), string (S1) and date (D1) parameters to and from KSH scripts:

# Note KSH allows no spaces around = in variable assignment
N1=`expr $N1 + $N1` # Add numeric variable to itself
S1="$S1 $S1"  # Concatenate string
echo "Concatenated string" $S1
DTEMP="1999/12/31 23:59:59,000 GMT"
echo You said $D1, I propose $DTEMP
D1=$DTEMP   # Set DateTime to new string value

The following example shows you how to return a non-zero exit code resulting in the process going into Error:

N=1
echo "Exiting with value $N."
exit $N

echo "Not reached"

See Also

  • Platform Agent Definition Types
  • Command Line System Tools
← Using the BASH Definition TypeUsing the CSH Definition Type →
  • Interpreter
  • Writing portable KSH scripts
  • Environment
  • Variables and Parameters
  • Returning an Error
  • KSH Examples
  • 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 |