Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

rsh not working from inittab

Status
Not open for further replies.

Einstein47

Programmer
Nov 29, 2001
737
US
Hey all,

I am trying to keep two servers in sync. When the database server (box1) gets rebooted, I need to run a job on the application server (box2). So in the inittab of box1 I added a script to touch a trigger file on box2. Then I have a cron on box2 that looks for the trigger file, and when it finds this trigger, the cron deletes it and runs the specific job. (That is how it is supposed to work).

However, when box1 is rebooted I can see from a log file that the rsh touch was performed, but the trigger file never gets created on box2. Isn't inittab run as root? I have made sure that root has rlogin permissions from box1 to box2. I have even run the script by hand on box1 and have seen the trigger file be created on bix2 (so I know it isn't a permission problem, or a network problem).

The only thing I can think of is that inittab isn't run as root. Can someone point me in the right direction?

Thanks in advance, Einstein47
(The greatest trick the devil ever did was to convice the world he didn't exists.)
 
inittab does indeed run as root. I am confused though...

>> However, when box1 is rebooted I can see from a log file that the rsh touch was performed, but the trigger file never gets created on box2.

How can the rsh touch run, but trigger file not created ? Isn't that one in the same.

Please differentiate between the touch and the trigger file. I thought the touch was for the trigger file.

Bill.
 
Now you can see my confusion. Here is a part of the script rc.trigger in the /etc directory:

touch /home/informix/trigger
su informix -c "rsh appserver touch trigger"

mailx -s &quot;trigger touched&quot; &quot;email&quot; <<EOF
The dbserver set the trigger file.
EOF

as you can see I touch a local file, the remote file, and then email myself a message to know that the script ran. I am just experimenting with the su to informix. There is a different script that can rsh from informix, so I wanted to try that.

I am also calling this script from cron just in case it is the inittab that is giving me fits. I would hate to have to work more on Saturday than I need to. Einstein47
(The greatest trick the devil ever did was to convice the world he didn't exists.)
 
Einstein,

Well there are a few simple steps to perform here :

1) Run from the command line:

touch /home/informix/trigger
su informix -c &quot;rsh appserver touch trigger&quot;

This ensures that the command works i.e. that rsh is successful.

2) How is this invoked when the machine is booted are you using /etc/rc.shutdown ?

Basically you are doing a simple rsh and touching a file this should work without any problems.

Cheers

PSD
IBM Certified Specialist - AIX V4.3 Systems Support
IBM Certified Specialist - AIX V4 HACMP
 
I think the problem lies in the &quot;su&quot; command.

Try su - informix -c &quot;rsh appserver touch trigger&quot;

Also, there was a recent thread on another AIX list on the placement of the &quot;-c&quot;. Try also

su - informix &quot;-c rsh appserver touch trigger&quot;

If you don't specify the first &quot;-&quot;, the $HOME variable is not reset, so $HOME remains &quot;/&quot;, which most likely the informix user does not have access to write to the &quot;/&quot; directory, which is what $HOME is for root.

Bill.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top