Home > Net >  ksh remote function calling another remote function3
ksh remote function calling another remote function3

Time:09-17

#!/bin/ksh
set -x 

function test_me
{
set -x
date
}

function check_me 
{
set -x
ssh HST2 "$(typeset -f test_me); test_me"
}

ssh HST1 "$(typeset -f); check_me"

Fails with syntax error at line 5: `;;' unexpected can some on help ?

from sath I am logging on Oracle RAC cluster.. I login on first node of RAC1A, then prepare list of database on this RAC1, on various node RAC1B, RAC1C, RAC1D... then login on each of RAC1B and connect to DB... $HST1 and $HST2 is just to hide the hostname, you can put anything you like .... SATH ==> RAC1A ===> RAC1B ... where HST1 is RAC1A and HST2 is RAC1B –

IF you have any 3 paired server where ssh keys is rolled out in SATH ==> RAC1A ===> RAC1B, you can test above code .. SATH ==> HST1 ===> HST2

CodePudding user response:

#!/bin/ksh
set -x 

function a
{
set -x
date
}

function b
{
set -x
ssh HST2 "$(typeset -f a); a"
}

ssh HST1 "$(typeset -f); b"

Above code works fine where inner function is alphabetical order ascending..

CodePudding user response:

#!/bin/ksh
set -x 

function b
{
set -x
date
}

function a
{
set -x
ssh HST2 "$(typeset -f b); b"
}

ssh HST1 "$(typeset -f); a"

Above code fails where inner function name is alphabetical order descending.. Fails with syntax error at line 5: `;;' unexpected

  • Related