man uaps




NAME

  uaps - ps process tree listing


SYNOPSIS

  uaps
          [-index] [-tty] [-debug|-verbose] [-p pid]
          [-f file | -o ps_options] [-n osname]
          [-children] [-l length] [-m length]


DESCRIPTION

  The  uaps  command  produces  a process tree listing associating a process with its
  children and ancestors.


OPTIONS

  -p pid
          Request a pid with children and ancestors.

  -b
          Write "bpstat -P" compatable output.

  -f file
          Replay a captured ps listing.

  -n osname
          Specify an operating system.  Useful only when replaying file with platform
         specific ps limitations.  Use -d to obtain a list of known platforms.

  -o ps_options
         Use   alternate  'ps  -o'  options.   The  default  for  most  platforms  is
         'tty,user,pid,ppid,etime,time,pcpu,args'.  The 'tty,user,pid,ppid,args'  are
         always  used  and  need not be specified, but the 'etime,time,pcpu' resource
         options can be replaced, for example:  '-o  cpu,vsz'.   Note,  different  ps
         implementations  use different -o options, see "man ps".  Use '-o .'  for no
         resources.

  +o ps_options
         Add options to platform defaults, such as '+o wchan:12'.

  -index
          Include process index information.

  -tty
          Show tty information.

  -verbose
          Verbose output.

  -debug
          Include process tree debugging information.

  -children
          Display only children (no parents)

  -l length
          Specify line length for display. The default and maximum is 132. The  maxi-
         mum is 512.

  -W width
          Alias for -length.

  -m length
          Specify maximum usename length, default is maximum length found from "ps -o
         user:32".
          Names longer than 32 will be displayed as numeric by ps.


EXAMPLES

  Requesting the current process:

   platinum: ./uaps -p $$

   #  pid  ppid user  ELAPSED TIME | command:children
    41765 41723 kcar     4:32 0:00 | -ksh
    41799 41765 kcar     0:00 0:00 | ./uaps -p 41765
    41768 41799 kcar     0:00 0:00 | ps -A -o tty,user,pid,ppid,etime,time,pcpu,args

   #  pid  ppid user  ELAPSED TIME | command:ancestors
    41723   295 root     4:40 0:00 | /usr/software/sbin/sshd
      295     1 root 08:57:55 0:09 | /usr/software/sbin/sshd
        1     0 root 08:58:17 0:18 | /etc/init

  Requesting specific resources:

   platinum: ./uaps -p 41765 -o time,vsz

   #  pid  ppid user TIME VSZ    | command:children
    41765 41723 kcar 0:00    784 | -ksh
    41690 41765 kcar 0:00   1472 | ./uaps -p 41765 -o time,vsz
    41817 41690 kcar 0:00   1728 | ps -A -o tty,user,pid,ppid,time,vsz,args

   #  pid  ppid user TIME VSZ    | command:ancestors
    41723   295 root 0:00   3044 | /usr/software/sbin/sshd
      295     1 root 0:09   2472 | /usr/software/sbin/sshd
        1     0 root 0:18   1560 | /etc/init

  Combined with uaklogin looking for orphaned processes:

    icehawk1: uaklogin -r. =ppid 1 +u root | grep -v "^#" |
      nawk '{print $2}' | while read P; do
        uaps -p$P -c -o. -l52
      done

    #  pid  ppid user | command:children
     12294     1 mort | sh ./eclipse-2001a_2/tool
     16678 12294 mort | grep -v Queue   Dev
     23870 12294 mort | lpstat -a
     35462 23870 mort | /usr/bin/enq -q -A
     35286 35462 mort | /usr/bin/enq -q -A
     32634 35286 mort | ksh /usr/lib/lpd/bsdshort
     19992 32634 mort | rembak -P text -S sois-ops.netpr
     31296 32634 mort | /usr/bin/tr -d
     37260 32634 mort | /usr/bin/awk ?BEGIN?{???#----Set


NOTES

  The uaps program was written as a test/sample program for  the  uaps_get()  routine
  which  gathers  process  information  and  is utilized by the uaklogin program, but
  proved useful as a stand alone program.  This program works by internally piping  a
  ps  command  (typically  suid)  and constructing pid|ppid relationships.  For addi-
  tional process filtering options (by userid, command, terminal) and for utmp  rela-
  tionships use uaklogin.

  The  uaps  command has been tested under IBM AIX 4.3 through 5.13 Digital|Compaq|HP
  OSF1|Tru64 4.0d, SGI IRIX 6.5, Cray UNICOS 10.0, Cray UNICOS/MK  2.0.5,  Cray  UNI-
  COS/MP  2.1, NEC SUPER-UX 12.1, various Linux, SunOS 5.6, Mac OSX, and cygwin (Win-
  dows).  The cygwin ps implementation is very limited an does not support -o.  There
  is  a  generic  mode  which  should  work with any UNIX with no resources using '-o
  tty,user,pid,ppid,args'.


ACKNOWLEDGEMENTS

  Written at the University of Alaska.  Ongoing maintenance via SourceForge by Denali
  Sun Consulting.

  Suggestions or bug reports can be directed to denalisun907@gmail.com.


RELATED INFORMATION

    Commands: uaklogin(1), ps(1).