Using Perl in Unix jobs
search cancel

Using Perl in Unix jobs

book

Article ID: 88694

calendar_today

Updated On:

Products

CA Automic Workload Automation - Automation Engine

Issue/Introduction

Using Perl in Unix jobs

This article applies to Automation Engine version 10.

With version 11.1 and above we have a new way dealing with external interpreters.

Administration Guide > Administering the Automation Engine > Configuration > UC_EXT_INTERPRETERS_* - Register External Interpreters​

Environment

Release: AUTWAB99000-10.0-Automic Workload Automation-Base Edition
Component:

Resolution

Detailed Description and Symptoms
There are several options on the UNIX tab of the UNIX job to run shell scripts.  However, there is no option for using Perl scripting.  I would like to use it, how can I go about doing it?

Investigation
Perl scripting is not a standard feature in Automic.  The solution presented here is not officially supported by our Support team.  Extensive troubleshooting and alterations will need to be done and can be contracted through our fee-based consulting group, Global Services Organization (GSO). 

To set up an appointment with GSO, please contact your Customer Relationship Manager (CRM) or Account Manager (AM).

Solution

To be able to run a PERL-Script using a UNIX-Executor please proceed as follows:

 

 1) A new entry has to be added in the variable object 'UC_SHELL_UNIX' in Client '0000'.
Validity Keyword: Perl
Value: 'Perl Interpreter' (or any other appropriate comment)

<Please see attached file for image>

0EMb0000001Qr5R.png

 

 2) The Executor/Agent mus be started in batch mode:
batch mode[STARTCMD] has to look like this:

 

[STARTCMD]

 

start_type = batch

;

; default start_type is fork

; the next scripts are only necessary if the start_type ist batch.

; if you are using batch, so the script have to be activated.

 

Bourne-Shell = `su - &user -c "&jobFile 1>> &jobReport 2>&1"`&

C-Shell = `su - &user -c "&jobFile >>& &jobReport"`&

Korn-Shell = `su - &user -c "&jobFile 1>> &jobReport 2>&1"`&

Other-Shell = `su - &user -c "&jobFile 1>> &jobReport 2>&1"`&

 

 3) The user account which starts the executor has to be 'root''.
It is not enough to set the s-bit for the executable

 

 4) Modifications to HEADER_UNIX (Client 00000):

The following single line has to be replaced by the six lines between 'NEW BEGIN' and 'NEW END'

&UC_JOBMD IPA=&UC_IP_ADDR PNR=&UC_IP_PORT MNR=&UC_MANDANT JNR=&UC_REALNR TYP=S TXT=" Job started"

 

!-- NEW BEGIN --

:set &uxshell=get_att(UNIX_SHELL)

:if &uxshell &lt;> "perl"

&UC_JOBMD IPA=&UC_IP_ADDR PNR=&UC_IP_PORT MNR=&UC_MANDANT JNR=&UC_REALNR TYP=S TXT=" Job started"

:else

system("&UC_JOBMD MNR=&UC_MANDANT IPA=&UC_IP_ADDR JNR=&UC_REALNR PNR=&UC_IP_PORT TYP=S");

:endif

!-- NEW END --

 

 5) Modifications to TRAILER_UNIX (Client 00000):
A line has to be added.

 

##UC4[sh]&UC_JOBMD MNR=&UC_MANDANT IPA=&UC_IP_ADDR JNR=&UC_REALNR PNR=&UC_IP_PORT TYP=E RET=$? TXT=" Job ended" TRC=0

##UC4[ksh]&UC_JOBMD MNR=&UC_MANDANT IPA=&UC_IP_ADDR JNR=&UC_REALNR PNR=&UC_IP_PORT TYP=E RET=$? TXT=" Job ended" TRC=0

##UC4[csh]&UC_JOBMD MNR=&UC_MANDANT IPA=&UC_IP_ADDR JNR=&UC_REALNR PNR=&UC_IP_PORT TYP=E RET=$status TXT=" Job ended" TRC=0

##UC4[tcsh]&UC_JOBMD MNR=&UC_MANDANT IPA=&UC_IP_ADDR JNR=&UC_REALNR PNR=&UC_IP_PORT TYP=E RET=$status TXT=" Job ended" TRC=0

##UC4[bash]&UC_JOBMD MNR=&UC_MANDANT IPA=&UC_IP_ADDR JNR=&UC_REALNR PNR=&UC_IP_PORT TYP=E RET=$? TXT=" Job ended" TRC=0

!-- the following line has to be added:

##UC4[perl]system("&UC_JOBMD MNR=&UC_MANDANT IPA=&UC_IP_ADDR JNR=&UC_REALNR PNR=&UC_IP_PORT TYP=E RET=$?");

 6) In the UNIX-tab of the job 'perl' has to be selected as 'Shell'

Attachments

1558693214697000088694_sktwi1f5rjvs16m3y.png get_app