xref: /plan9/sys/lib/dist/pc/inst/watchfd (revision d8635c2e197bbca90dd25be5412584a55b796e27)
1#!/bin/rc
2
3p=`{ps | grep $1 | sed 's/[^ ]* +([^ ]+) .*/\1/' }
4while(! ~ $#p 1) {
5	sleep 1
6	p=`{ps | grep $1 | sed 's/[^ ]* +([^ ]+) .*/\1/'}
7}
8p=$p(1)
9
10baropt='-w 145,129,445,168'
11if(~ $textinst 1)
12	baropt=-t
13
14{
15	while(test -f /proc/$p/fd)
16		grep '^ *'^$2^' ' /proc/$p/fd >[2]/dev/null
17} | awk '{print $9 " '^$3^'"; fflush("/dev/stdout")}' | bargraph $baropt $4
18