ADSM-L

Re: [ADSM-L] TSM/EE 6.3.5 has two dsmserv processes

2014-12-12 13:17:59
Subject: Re: [ADSM-L] TSM/EE 6.3.5 has two dsmserv processes
From: "J. Adam Craig" <jacraig AT VCU DOT EDU>
To: ADSM-L AT VM.MARIST DOT EDU
Date: Fri, 12 Dec 2014 13:16:20 -0500
Hi Keith,

I work with Zoltan here at Virginia Commonwealth University -- not sure if
"guru" is an accurate description!  :-)

Here are the processes that I'm seeing when I grep for 'dsmserv' after the
update is applied:

root@processor ~ # ps -ef | grep dsmserv
root      4202     1  0 11:01 ?        00:00:00 su - tsminst1 -c
/opt/tivoli/tsm/server/bin/dsmserv  -i /home/tsminst1 -q
tsminst1  4297  4202  0 11:01 ?        00:00:06
/opt/tivoli/tsm/server/bin/dsmserv -i /home/tsminst1 -q
root     16081  4554  0 12:56 pts/1    00:00:00 grep --color=auto dsmserv


Initially, this looks problematic, however, let's take note of a couple of
things:

   1. Looking first at PID 4202, this process is owned by the 'root' user,
   and is using 'su' to instruct the command
   '/opt/tivoli/tsm/server/bin/dsmserv -i /home/tsminst1 -q' to run as user
   'tsminst1'
   2. Now, the second item, which at first glance appears to be a duplicate
   instance of the 'dsmserv' process, is actually the only 'real' instance of
   the process that is running.  The first item is not a process at all, but
   rather the 'root' account telling 'dsmserv' to run as user 'tsminst1'
   rather than as the 'root' user.  This process, PID 4297, has a PPID (parent
   PID) of '4202', which tells us that PID 4297 was spawned by PID 4202.
   Notice that PID 4297 is owned by the 'tsminst1' user, and is running the
   command '/opt/tivoli/tsm/server/bin/dsmserv -i /home/tsminst1 -q', which is
   exactly what PID 4202 asked for.
   3. PID 4202 will continue running until PID 4297 ('dsmserv') has stopped
   running.

If you're curious about the nuts and bolts going on in the background, on
our TSM servers, we have a file in '/etc/init.d' called
'tsminst1_dsmser.rc'.  In the 'start()' section of this file, there is a
line that passes some variables along to another file at
'/opt/tivoli/tsm/server/bin/rc.dsmserv' to bring up the TSM server
process.  In our file, that line looks like this:

$prefix/tivoli/tsm/server/bin/rc.dsmserv -u $instance_user -i $instance_dir
-q >/dev/null 2>&1 &


So, '/etc/init.d/tsminst1_dsmserv.rc' is taking variables defined earlier
in the file, namely '$instance_user' and '$instance_dir', and passing them
through to '/opt/tivoli/tsm/server/bin/rc.dsmserv'.  So, to see what that
file does once it gets the variables, let's take a look.

After doing some logic and some work, we eventually arrive at a block of
code at the bottom of the 'rc.dsmserv' file that looks like this:

if [ "$instanceUser" != "" ]; then
  exec su - $instanceUser "-c /opt/tivoli/tsm/server/bin/dsmserv $cmdParms"
else
  exec /opt/tivoli/tsm/server/bin/dsmserv $cmdParms
fi


Since '/etc/init.d/tsminst1_dsmserv.rc' passed a username that should own
the running instance of the TSM server ('tsminst1'), the variable
'$instanceUser' is NOT null, so we end up running the

exec su - $instanceUser "-c /opt/tivoli/tsm/server/bin/dsmserv $cmdParms"


line.  If we'd not defined an instance user, we wouldn't pass the condition
on the IF statement, and we'd end up calling 'dsmserv' as 'root' instead,
as per the ELSE statement:

exec /opt/tivoli/tsm/server/bin/dsmserv $cmdParms


Note that, substituting the variable assignments for the variables
themselves, the 'exec su - $instanceUser...' line gives us exactly what we
see for, in my case, PID 4202 in the 'ps -ef' output.

Hope this helps!  Best,
-- Adam

______________________
*J. Adam Craig*
Linux & Windows Operating Systems Engineer
VCU Computer Center
804.828.4886

"Don't be a phishing victim -- VCU and other reputable organizations will
never use email to request that you reply with your password, social
security number or confidential personal information.  For more details,
visit http://infosecurity.vcu.edu/phishing.html";

On Fri, Dec 12, 2014 at 12:51 PM, Arbogast, Warren K <warbogas AT iu DOT edu>
wrote:
>
> So Zoltan,
> What does your Linux guru have to say about the possible consequences of
> having the two processes running? Is it a neutral matter, or not?
>
> Thank you,
> Keith