1

Two issues:

  1. pf -fU <user> not showing particular user processes while ps -ef | grep <user> or ps aux can.

  2. pstree -p <pid>, where pid is that particular process I mentioned above, can give output of the child processes while ps -ef | grep <childpid> doesn't show any.

And thisweird behavior is seen only for processes related to this particular sge service which was started using service command and not for any other processes.

[root@myserver ~]# ps -fU sgeadmin
UID        PID  PPID  C STIME TTY          TIME CMD
[root@myserver ~]# ps -ef | grep sgeadmin
sgeadmin  1754     1  0 Jan21 ?        00:16:36 /ge2011.11/bin/linux-x64/sge_execd
root      4097  3982  0 18:52 pts/0    00:00:00 grep sgeadmin
sgeadmin 27248     1  0 16:59 ?        00:00:03 /ge2011.11/bin/linux-x64/sge_qmaster
[root@myserver ~]# pstree -paA 27248
sge_qmaster,27248
  |-{sge_qmaster},27255
  |-{sge_qmaster},27256
  |-{sge_qmaster},27257
  |-{sge_qmaster},27258
  |-{sge_qmaster},27263
  |-{sge_qmaster},27264
  |-{sge_qmaster},27265
  |-{sge_qmaster},27266
  |-{sge_qmaster},27267
  |-{sge_qmaster},27268
  |-{sge_qmaster},27269
  `-{sge_qmaster},27289
[root@myserver ~]# ps -ef | grep -E '27255|27256|27257|27258|27263|27264|27265|27266|27267|27268|27269|27289'
root      4274  3982  0 18:53 pts/0    00:00:00 grep -E 27255|27256|27257|27258|27263|27264|27265|27266|27267|27268|27269|27289
[root@myserver ~]#

So I tried starting other processes and it's working:

myserver @ /homes/sgeadmin : sleep 1000 &
[1] 4528
myserver @ /homes/sgeadmin : ps -fU sgeadmin
UID        PID  PPID  C STIME TTY          TIME CMD
sgeadmin  4482  4481  0 18:57 pts/0    00:00:00 -tcsh
sgeadmin  4528  4482  0 18:57 pts/0    00:00:00 sleep 1000
sgeadmin  4529  4482  0 18:57 pts/0    00:00:00 ps -fU sgeadmin
myserver @ /homes/sgeadmin : exit
logout
[root@myserver ~]# ps -fU sgeadmin
UID        PID  PPID  C STIME TTY          TIME CMD
sgeadmin  4528     1  0 18:57 pts/0    00:00:00 sleep 1000
[root@myserver ~]#

Edit 1:

Okay, ps -fu <username> gives output. It seems the difference is there in real user id and effective userid. Yes, root is the real user in this case.

But any explanation for the second issue? pstree showing the child processes while ps -ef doesn't?

Edit 2:

Okay, it is something to do with TGID.

2

This answers it clearly: https://stackoverflow.com/questions/9305992/linux-threads-and-process

Here in my case, all the child processes displayed are threads and hence, can't be seen in ps -ef output but only pstree.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.