LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 09-05-2011, 01:27 AM   #1
kumarancs
LQ Newbie
 
Registered: Sep 2011
Posts: 3

Rep: Reputation: Disabled
Aix - Linux Scripts Migration Issues


Hi,

We are migrating applications from AIX server to Linux(Red-Hat). One of the script is not running as expected. This script is basiclly loading data from Flat file into oracle DB. This script is connecting to db a method called co-processor. This is something like Terminate and Stay Resident Program. When the scirpt is invoked, after the call to db connectivity remains hanging.

It would be great if somebody can help to resolve this issue.

S. Kumaran
 
Old 09-05-2011, 10:32 AM   #2
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 2,227

Rep: Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893
flying blind

So, you want our advice on making a shell script work without a copy of the script (or even just the critical lines), knowing it connects to a service somehow (but not how, or on what port)?

Some here do something you might call wizardry, but neither magic nor telepathy is involved. Can you give us something to work on?
 
Old 09-06-2011, 08:29 AM   #3
kumarancs
LQ Newbie
 
Registered: Sep 2011
Posts: 3

Original Poster
Rep: Reputation: Disabled
The code will be something like the following:


#! /bin/ksh -p

function main
{
TST_USER=user1
TST_KEY=user123
TST_SID=TST
if ! coprocessor_start TST user1 user123 TST
then
coprocessor_stop TST
print could not connect
exit 2
fi

if ! coprocessor_start SYS system manager TST
then
coprocessor_stop SYS
print could not connect
exit 2
fi
print connected
cops_write TST "select user from dual;"
cops_read TST;

cops_write TST "select count(*) from all_objects;"
cops_read TST;

cops_write SYS "select user from dual;"
cops_read SYS;

cops_write SYS "select count(*) from all_objects;"
cops_read SYS;

coprocessor_stop TST
coprocessor_stop SYS

echo done
}

. coprocess_lib.sh

# Redefine stdout as file descriptor 9
exec 9>&1

# Create a co-process for "tee" and redirect its output to file descriptor 9
tee ${EXECUTION_LOG} >&9 |&

# Redirect the co-process' output to stdout
exec >&p

# Execute main() and redirect stderr to stdout
main 2>&9
RC=$?

# Cancel the stdout redirection
exec >&- >&9

wait

exit $RC


---------------------

The issue is the code is hanging in the call copressor_start which is a function written in the other script and called from this script

the function of coprocessor_start code will look like as follows:

http://www.akadia.com/services/ora_co_processes.html

----------------------
 
Old 09-06-2011, 06:17 PM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.9, Centos 7.3
Posts: 17,374

Rep: Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383Reputation: 2383
Well, I'd start by adding
Code:
set -xv
to the coprocessor_start code to see exactly what its doing.
 
Old 09-07-2011, 11:50 AM   #5
wpeckham
Senior Member
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, Fedora, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, Vsido, tinycore, Q4OS
Posts: 2,227

Rep: Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893Reputation: 893
I agree

Chris hit step one: do that.

Also, check your shells. Linux server CAN have KSH, but the version and features will differ slightly from the IBM standard. I might try using the BASH shell and see if the behavior changes. Make the shbang line look like
#!/bin/bash

That -P on a KORN shell usually means it should read the profile. I would explicitly dot-load the profile I want, or build it within the script instead. You do not HAVE to, but building your environment directly gives you control: you avoid unintended consequences of changed or 'improved' profile elements. Since it is almost certain that there are profile differences between the environments, this may be worth locking down.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Migration of script from Aix to Linux smk.muthu Linux - Newbie 3 08-31-2011 07:15 PM
Linux to *BSD migration. FS issues. Gavin Harper Linux - Server 2 04-13-2011 11:19 PM
Shell scripts migration from SunOS 5.9 to Red Hat Linux Advanced Server 4.0 64-bit devenr_2000 Linux - Newbie 1 11-13-2007 12:08 PM
Gentoo 2.4 - 2.6 migration issues Atreyou40 Linux - Kernel 2 07-01-2006 06:16 PM
AIX to Linux Migration damine Red Hat 0 01-06-2005 09:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration