How would I determine which script is being executed by a process? When I use:
ps -u user
I get the following output:
10005194 26932 0.0 0.0 112700 1544 ? Ss Jun03 0:00 -bash
10005194 27117 0.0 0.0 112700 1528 ? Ss Apr24 0:00 -bash
10005194 27164 0.0 0.0 112700 2040 ? Ss Jun06 0:00 -bash
10005194 27404 0.0 0.0 112700 1544 ? Ss May27 0:00 -bash
10005194 27484 0.0 0.0 112700 1528 ? Ss Apr23 0:00 -bash
10005194 27531 0.0 0.0 112700 1528 ? Ss May22 0:00 -bash
...
There are hundreds of lines. I know that there are a number of scripts that this user is executing, but I would like to narrow down which of the scripts is holding onto threads. Is there a way to do this?
top
? – Wildcard Jun 08 '16 at 01:38bash
. – GoldfishGrenade Jun 08 '16 at 01:45pstree user | grep bash
to see if bash is running something or just an active shell. – Hesham Ahmed Jun 08 '16 at 01:50pstree
becomes useless when piped togrep
. – Wildcard Jun 08 '16 at 02:14-sshd-+-sshd---bash---ping
useless in finding out what bash is doing? – Hesham Ahmed Jun 08 '16 at 02:18-
. Also a shell will automatically exit once the thing connected to its STDIN goes away, so something is still holding them open (tmux/screen?). Have you tried runningw
(which will show you TTYs, and how long they've been idle for)? – phemmer Jun 08 '16 at 04:24#!/usr/bin/env
. See http://unix.stackexchange.com/a/238470/7696 – cas Jun 08 '16 at 06:53exit 0
to the end of one of the scripts, it seemed to stop new ones from accumulated. Why is that? – GoldfishGrenade Jun 08 '16 at 07:03