Operating System - HP-UX
1753792 Members
7347 Online
108799 Solutions
New Discussion юеВ

Starting informix using remsh from another server

 
SOLVED
Go to solution
Kenneth_18
Frequent Advisor

Starting informix using remsh from another server

On serverB, I have a script to start-up informix, load some table data and then shutdown the server. This script is working when executed as user1 (with root UID of 0) and is working perfectly fine.

The script is shown below: Note that $INFORMIXDIR is set to /opt/informix for both user1 and informix user env variable in serverB

synchtbl.sh
==============================================
#!/bin/sh

su informix -c "$INFORMIXDIR/bin/oninit"
sleep 5

su informix -c "echo 'delete from table1'|dbaccess informixdb"

su informix -c "echo \"load from \"/tmp/table1.db\" insert into table1\"|dbaccess informixdb"

su informix -c "/opt/informix/bin/onmode -ky"
echo "Finished Importing DB"
==============================================

From serverA, I wish to execute the script remotely using the following command below:

remsh serverB "/home/user1/synctbl.sh"

However, I get the following error:

"Could not access INFORMIXDIR /usr/informix"

What could be my problem? In serverA and serverB, the same user1 and informix are created with the same UIDs. From serverA, I can successfully do rcp and other remsh commands on serverB.

Thanks in advance for the help and adice!

--Ken
6 REPLIES 6
Torsten.
Acclaimed Contributor

Re: Starting informix using remsh from another server

I have noticed you wrote:

$INFORMIXDIR is set to /opt/informix

and

Could not access INFORMIXDIR /usr/informix

It is at first /opt, later /usr

Did you set INFORMIXDIR to the correct value?

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Kenneth_18
Frequent Advisor

Re: Starting informix using remsh from another server

As stated in my post, $INFORMIXDIR is set to /opt/informix for both user1 and informix user and running the script from within serverB as user1 is working perfectly fine.

When you try to execute the script remotely from serverA using remsh as user1, I get the error

"Could not access INFORMIXDIR /usr/informix"

The above error message is not a typo error.

Hope you could provide further insights to my problem.

Regards,
--Ken
Torsten.
Acclaimed Contributor

Re: Starting informix using remsh from another server

I didn't say "typo".

It is telling you, that INFORMIXDIR is /usr/informix and cannot be found.

Try to remsh and echo the variable.

Notice, the man page says:

If the remote shell is /usr/bin/sh, the following command line sets up
the environment for the remote command before executing the remote
command:

remsh otherhost . .profile 2>&- \; command

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Torsten.
Acclaimed Contributor

Re: Starting informix using remsh from another server

In your case first run

remsh serverB "/usr/bin/echo $INFORMIXDIR"
remsh serverB . .profile 2>&- \; "/usr/bin/echo $INFORMIXDIR"

and compare.
Now try

remsh serverB . .profile 2>&- \; "/home/user1/synctbl.sh"

Hope this helps!
Regards
Torsten.

__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.

__________________________________________________
No support by private messages. Please ask the forum!

If you feel this was helpful please click the KUDOS! thumb below!   
Steve Lewis
Honored Contributor
Solution

Re: Starting informix using remsh from another server

Your script needs to have the required informix environment variables defined and exported at the top.
These are the bare minimum you need:

INFORMIXDIR=
INFORMIXSERVER=
ONCONFIG=
PATH=$PATH:$INFORMIXDIR/bin


btw dont forget to update the statistics for your tables every so often.
Kenneth_18
Frequent Advisor

Re: Starting informix using remsh from another server

When I do a remsh serverB "echo $INFORMIXDIR" I do get it as /opt/informix. But thanks so much for helping out Torsten. Steve has provided the working solution.

Thanks again guys!