Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,369

    Unanswered: ps eww - check environment variables

    I sometimes need to check the env variables that were set at the time of db2start. I use "ps eww <PID of db2sysc>". This works fine on AIX. I also checked on Linux RHEL and it looks ok too.


    From RHEL:

    <-instv9->/etc==> ps -ef | grep db2sysc
    instv9 24060 24059 0 16:33 pts/10 00:00:00 db2sysc 0
    instv9 24114 23951 0 16:43 pts/10 00:00:00 grep db2sysc


    <-instv9->/etc==> ps eww 24060
    PID TTY STAT TIME COMMAND
    24060 pts/10 S 0:00 db2sysc 0 HOME=/home/instv9 KRB5CCNAME=
    FILE:/tmp/krb5cc_p23950 PWD=/home/instv9 DB2INSTANCE=instv9 DB2INSTDEF=instv9 DB2LPORT=0 DB2NODE=0
    HOSTNAME=xxxxxxx.com LANG=en_US.UTF-8 USER=instv9 CLASSPATH=/home/instv9/sqllib/java/db2java.zip:
    /home/instv9/sqllib/java/db2jcc.jar:/home/instv9/sqllib/java/sqlj.zip:/home/instv9/sqllib/function:/home/instv9/
    .....




    From SUSE Linux 10:

    ps -ef | grep db2sysc
    ldaptw 5408 5407 0 14:02 pts/0 00:00:00 db2sysc 0
    ldaptw 5493 4403 0 14:04 pts/0 00:00:00 grep db2sysc


    ps eww 5408
    PID TTY STAT TIME COMMAND
    5408 pts/0 S 0:00 db2sysc 0



    Any idea why "ps eww" doesn't display env variables?

  2. #2
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    ps implementation differ; check the man page for your particular installation.
    ---
    "It does not work" is not a valid problem statement.

  3. #3
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,369
    Thanks, Nick.

    I think I now understand what is wrong. Cust must have issued this command when logged in as some other user id. From the info provided, it looked as if he was executing it using ldaptw.

  4. #4
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,369
    My cust tried ps eww on AIX and several Linux servers and it worked for all of them expect SUSE 10. He was logged in as the instance id. I also tried it on several Linux servers and it always displayed the env variables as long as I was doing it for my instance id.


    My results:

    $ whoami
    dbguest2

    $ cat /etc/SuSE-release
    SUSE Linux Enterprise Server 10 (ppc)
    VERSION = 10
    PATCHLEVEL = 1


    $ ps -ef | grep db2sysc
    dbguest4 23205 23199 0 Mar02 ? 00:02:15 db2sysc
    dbguest1 21904 21898 0 Mar09 pts/2 00:01:01 db2sysc
    dbguest2 6493 6487 0 Mar09 pts/1 00:00:08 db2sysc
    dbguest2 17696 2227 0 13:27 pts/1 00:00:00 grep db2sysc


    $ ps eww 6493
    PID TTY STAT TIME COMMAND
    6493 pts/1 Sl 0:08 db2sysc HOME=/home/dbguest2 PWD=/etc DB2INSTANCE=dbguest2 HOSTNAME=xxxxxxx LANG=en_US.UTF-8 USER=dbguest2 CLASSPATH=.:/home/dbguest2/sqllib
    ....


    $ ps eww 21904
    PID TTY STAT TIME COMMAND
    21904 pts/2 Sl 1:01 db2sysc



    I thought I had it last night... Linux is too much fun.

  5. #5
    Join Date
    Jun 2003
    Location
    Toronto, Canada
    Posts
    5,516
    Provided Answers: 1
    I didn't realize at first that you were trying to get the environment for a different process. That obviously is not allowed; you can only see the environment of your own processes, unless you are root.
    ---
    "It does not work" is not a valid problem statement.

  6. #6
    Join Date
    Aug 2008
    Location
    Toronto, Canada
    Posts
    2,369
    Customer was logged in as instance_id when he issued "ps eww <PID of db2sysc for that instance_id>". This works on all of their servers (AIX/Linux) except for SUSE 10. The only way I could reproduce this "behaviour" (no env info is displayed) is if I try to get the environment for a different user.


    Anyway, there is another way of getting this info as described here:
    http://yong321.freeshell.org/computer/ProcEnv.txt

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •