|
@@ -1,75 +0,0 @@
|
1
|
|
-#!/bin/bash
|
2
|
|
-
|
3
|
|
-. $(ffoom path)
|
4
|
|
-
|
5
|
|
-ffoo import pretty
|
6
|
|
-ffoo import recon
|
7
|
|
-
|
8
|
|
-interval=2
|
9
|
|
-
|
10
|
|
-report_limits() {
|
11
|
|
- echo "ulimit -m:$(ulimit -m)"
|
12
|
|
- echo "ulimit -Sm:$(ulimit -Sm)"
|
13
|
|
- echo "ulimit -Hm:$(ulimit -Hm)"
|
14
|
|
- echo "ulimit -n:$(ulimit -n)"
|
15
|
|
- echo "ulimit -Sn:$(ulimit -Sn)"
|
16
|
|
- echo "ulimit -Hn:$(ulimit -Hn)"
|
17
|
|
-}
|
18
|
|
-
|
19
|
|
-report_on_pids() {
|
20
|
|
- local pid
|
21
|
|
- for pid in "$@";
|
22
|
|
- do
|
23
|
|
- echo "$pid:name:$(ps -p $pid -o comm=)"
|
24
|
|
- echo "$pid:rss:$(ps -p $pid -o rss=)"
|
25
|
|
- echo "$pid:files:$(lsof -p $pid | wc -l)"
|
26
|
|
- done
|
27
|
|
-}
|
28
|
|
-
|
29
|
|
-usage() {
|
30
|
|
- usage_is "[-i INTERVAL] [-d] -p PID[,PID]..." \
|
31
|
|
- "[-i INTERVAL] [-d] -r REGEX[,REGEX]..."
|
32
|
|
-}
|
33
|
|
-
|
34
|
|
-regexes=""
|
35
|
|
-pids=""
|
36
|
|
-
|
37
|
|
-while true;
|
38
|
|
-do
|
39
|
|
- case $1 in
|
40
|
|
- -i|--interval)
|
41
|
|
- interval=$2
|
42
|
|
- shift 2
|
43
|
|
- ;;
|
44
|
|
- -r|--regexes)
|
45
|
|
- regexes=$2
|
46
|
|
- shift 2
|
47
|
|
- ;;
|
48
|
|
- -p|--pids)
|
49
|
|
- pids=$2
|
50
|
|
- shift 2
|
51
|
|
- ;;
|
52
|
|
- "")
|
53
|
|
- if test -z "$regexes" && test -z "$pids";
|
54
|
|
- then usage;
|
55
|
|
- else break;
|
56
|
|
- fi
|
57
|
|
- ;;
|
58
|
|
- *)
|
59
|
|
- usage
|
60
|
|
- ;;
|
61
|
|
- esac
|
62
|
|
-done
|
63
|
|
-
|
64
|
|
-pids=$(tr "," " " <<<"$pids")
|
65
|
|
-regexes=$(tr "," " " <<<"$regexes")
|
66
|
|
-
|
67
|
|
-report_limits
|
68
|
|
-while true;
|
69
|
|
-do
|
70
|
|
- # append PIDS from regexes to pids from command line
|
71
|
|
- current_pids="$pids $(pids_matching $regexes)"
|
72
|
|
- debug -v current_pids
|
73
|
|
- report_on_pids $current_pids
|
74
|
|
- sleep $interval
|
75
|
|
-done
|