[Linux-HA] Bug in DB2 script

Horms horms at verge.net.au
Sun Oct 2 21:34:48 MDT 2005


On Fri, Sep 30, 2005 at 10:06:11AM -0600, Alan Robertson wrote:
> Laurent LE PRIEUR wrote:
> >Hello,
> >
> >We have found a bug in /etc/ha.d/resource.d
> >
> >111c111
> ><         su $db2admin -c ". $db2profile; $*"
> >---
> >>        su - $db2admin -c ". $db2profile; $*"
> >
> >./db2 db2inst1 status
> >bash: /root/.bashrc: Permission denied
> >bash: /root/.bashrc: Permission denied
> >DB2 UDB instance db2inst1 is stopped
> >[root at webapp6 resource.d]# ./db2 db2inst1 monitor
> >bash: /root/.bashrc: Permission denied
> >bash: /root/.bashrc: Permission denied
> >
> >
> >
> >with su- it's OK
> 
> 
> Well... I've tested this before in the past and also recently (like in 
> the last month).  I have never seen or heard of this problem, and many 
> people are running it in production.
> 
> What user id is db2admin?  What's the value of $db2profile at this point?
> 
> What version of heartbeat?  What shell?  What OS?  What release?

The problem could be that su is, for some reason, trying to 
source the prevailing user's (root) /root/.bashrc as the $db2admin user, 
which fails due to permissions as one would reasonably expect.
su - on the the other hand is sourcing $db2admin's shell environemnt,
which of couse it can do as $db2admin

I'd suspect that this is causin because something is pulling in
/etc/profile. I wonder if the following might shed some light on it:

su $db2admin -c "set -x; . $db2profile; $*"


In any case, using su - gets my vote, it should ensure the environment
is clean.

-- 
Horms



More information about the Linux-HA mailing list