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.

  • 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 6: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: web.fe.up.pt/~jmcruz/etc/unix/sh-vs-csh.html – Alchemist Dec 31 '17 at 7: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 7: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 8:17
  • Umm... I would guess it is. What is the tty for zsched? – Att Righ Dec 31 '17 at 9:47

Your Answer

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

Browse other questions tagged or ask your own question.