1

I am working on Solaris 11 zone and I need to check which shell a running process is using. I have the PID but I am not sure where to get the information from.

I have a scenario where some resource limits (limit on open file descriptors) should be applied to all processes. But it looks like some processes are not following the limit. It might be possible that they are being launched using a different shell which has different limit parameters.

For a little insight, I am using the ulimit command in /etc/profile to set the files limit. That way, it gets set for every session, whenever a user logs in. The problem scenario is explained in detail in this question.

So I just need to see whether those processes are using Bash or some other shell. That would answer whether the assumption is correct or not.

Jeff Schaller
  • 66,199
  • 35
  • 114
  • 250
Alchemist
  • 551
  • 3
  • 10
  • 21
  • Open file descriptor limits are kernel based, not shell based. Why would it matter what shell the process is running? How are your resource limits configured? – Wildcard Dec 31 '17 at 06:51
  • @Wildcard I have added a link in the question where the problem is explained in detail if that might help. I am using /etc/profile file to set those limits. Someone suggested that /etc/profile is not used by all shells. That just might be possible. So I thought if something like that is happening, that might help explain the problem and what's going on. I was looking at this link: https://web.fe.up.pt/~jmcruz/etc/unix/sh-vs-csh.html – Alchemist Dec 31 '17 at 07:11
  • So this seems like a job for `pstree` to see the parents of process. `exec` falls that replace the spawning process might be in the way here (since you lose information about the spawner). In addition on linux machines `ps` will give tty information which is often the same as who spawned things. – Att Righ Dec 31 '17 at 07:33
  • @AttRigh I observed that all the processes which are following the open file limits and those which aren't have the same parent process ID. The parent process is zsched (I am working in a Solaris 11 zone.). Does that mean it nullifies the assumption that these processes might have been launched using a different shell? – Alchemist Dec 31 '17 at 08:17
  • Umm... I would guess it is. What is the `tty` for zsched? – Att Righ Dec 31 '17 at 09:47
  • @AttRigh It's pts/14. And that of those processes in question is not mentioned. There's just a question mark. – Alchemist Dec 31 '17 at 10:20
  • So you might want to see what else is running on pts/14 (this suggests that zsched was spawned from a terminal and they opened some processes not connected to any terminal). – Att Righ Dec 31 '17 at 10:23
  • @AttRigh Sorry I made a little mistake. The tty or pts of zsched is not showing up as well. – Alchemist Dec 31 '17 at 10:32
  • So I'm guessing that zsched is something to do with zones. https://docs.oracle.com/cd/E19044-01/sol.containers/817-1592/zone/index.html. I don't know anything about solaris so I think you've reached the edge of my knowledge! – Att Righ Dec 31 '17 at 10:46

0 Answers0