summaryrefslogtreecommitdiff
path: root/eg/scan/scan_ps
blob: a70f360b9fe8155458f2700b5b7a37a29f931358 (plain)
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
32
#!/usr/bin/perl -P

# $Header: scan_ps,v 3.0 89/10/18 15:15:47 lwall Locked $

# This looks for looping processes.

#if defined(mc300) || defined(mc500) || defined(mc700)
open(Ps, '/bin/ps -el|') || die "scan_ps: can't run ps";

while (<Ps>) {
    next if /rwhod/;
    print if index(' T', substr($_,62,1)) < 0;
}
#else
open(Ps, '/bin/ps auxww|') || die "scan_ps: can't run ps";

while (<Ps>) {
    next if /dataserver/;
    next if /nfsd/;
    next if /update/;
    next if /ypserv/;
    next if /rwhod/;
    next if /routed/;
    next if /pagedaemon/;
#ifdef vax
    ($user,$pid,$cpu,$mem,$sz,$rss,$tt,$stat,$start,$time) = split;
#else
    ($user,$pid,$cpu,$mem,$sz,$rss,$tt,$stat,$time) = split;
#endif
    print if length($time) > 4;
}
#endif