aboutsummaryrefslogtreecommitdiff
path: root/unix/hlib/spy.cl
blob: 31522f4dd42d791d3a02ca4c5374e8a93b2dbe21 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# SPY -- [MACHDEP] Give info on who is logged in, what they are up to,
# how much resources they have consumed, and so on.  This routine is
# machine dependent.

procedure spy()

begin
	string mach

	if ($nargs > 0) {
	    # "Verbose" mode: show UNIX processor status, filtering
	    # out all the uninteresting system processes.

	    print ("!!uname" | cl() | scan (mach)
	    if (strlwr (mach) == "ssol") {
		!! ps -ef | grep -v root
	    } else if (strlwr (mach) == "SunOS") {
		!! ps -axu | grep -v root
	    } else if (strlwr (mach) == "linux" || strlwr (mach) == "Darwin") {
		!! ps axuf | grep -v root
	    } else {
		!! ps -ef | grep -v root
	    }

	} else {
	    # Merely give info on who is logged in and what they are doing.
	    # The following is for Berkeley UNIX only.

	    !! w
	}
end