From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- unix/hlib/spy.cl | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 unix/hlib/spy.cl (limited to 'unix/hlib/spy.cl') diff --git a/unix/hlib/spy.cl b/unix/hlib/spy.cl new file mode 100644 index 00000000..31522f4d --- /dev/null +++ b/unix/hlib/spy.cl @@ -0,0 +1,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 -- cgit