diff options
author | Andrew Cady <d@jerkface.net> | 2022-08-06 13:23:16 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2022-08-06 13:23:16 -0400 |
commit | b61532af6a86d81d1633a4de144fccbb64f9e604 (patch) | |
tree | 6bb788a061c2fb70ae408d7d4afa763ea8f8782f | |
parent | a900e57cbc4a010eb570bb84fe9146f21999b3a9 (diff) |
don't use 'fireslay' anymore; get pids list in ioslay-mgr.sh and pass them to ioslay-firefox to kill there
-rwxr-xr-x | ioslay-firefox | 12 | ||||
-rwxr-xr-x | ioslay-mgr.sh | 25 |
2 files changed, 29 insertions, 8 deletions
diff --git a/ioslay-firefox b/ioslay-firefox index 40fbd7e..41aa6a4 100755 --- a/ioslay-firefox +++ b/ioslay-firefox | |||
@@ -40,7 +40,10 @@ iotop_reader() | |||
40 | if [ "$(sum $log)" -gt 4 ] | 40 | if [ "$(sum $log)" -gt 4 ] |
41 | then | 41 | then |
42 | log= # this is year zero; all past history is erased. | 42 | log= # this is year zero; all past history is erased. |
43 | fireslay | 43 | ( |
44 | set -x | ||
45 | kill $pids | ||
46 | ) | ||
44 | fi | 47 | fi |
45 | else | 48 | else |
46 | log=$(last 10 $log 0) | 49 | log=$(last 10 $log 0) |
@@ -74,4 +77,11 @@ sudo_iotop() | |||
74 | fi | 77 | fi |
75 | } | 78 | } |
76 | 79 | ||
80 | if [ $# -le 0 ] | ||
81 | then | ||
82 | exit | ||
83 | fi | ||
84 | |||
85 | pids=$* | ||
86 | |||
77 | sudo_iotop -qq -b $(printf '\55\55pid=%s\n' "$@") | iotop_reader | 87 | sudo_iotop -qq -b $(printf '\55\55pid=%s\n' "$@") | iotop_reader |
diff --git a/ioslay-mgr.sh b/ioslay-mgr.sh index 7d6461f..1241a68 100755 --- a/ioslay-mgr.sh +++ b/ioslay-mgr.sh | |||
@@ -5,6 +5,10 @@ then | |||
5 | enable -f /usr/lib/bash/sleep sleep | 5 | enable -f /usr/lib/bash/sleep sleep |
6 | fi | 6 | fi |
7 | 7 | ||
8 | export NOTICE=y | ||
9 | noticeLOG() { [ "$NOTICE" ] || return; echo "Notice: $*" >&2; } | ||
10 | debugLOG() { [ "$DBG" ] || return; echo "Debug: $*" >&2; } | ||
11 | |||
8 | . sliceweasel.lib.sh | 12 | . sliceweasel.lib.sh |
9 | 13 | ||
10 | vkill() | 14 | vkill() |
@@ -38,7 +42,6 @@ GROUP_BASENAME=firefox | |||
38 | 42 | ||
39 | group_procs=$(get_firefox_cgroup_procs) | 43 | group_procs=$(get_firefox_cgroup_procs) |
40 | 44 | ||
41 | wantcomm='Web Content' | ||
42 | ioslay= | 45 | ioslay= |
43 | lastprocs= | 46 | lastprocs= |
44 | SIGNALLED= | 47 | SIGNALLED= |
@@ -62,10 +65,14 @@ do | |||
62 | for pid in $procs | 65 | for pid in $procs |
63 | do | 66 | do |
64 | read comm < /proc/$pid/comm | 67 | read comm < /proc/$pid/comm |
65 | if [ "$comm" = "$wantcomm" ] | 68 | case "$comm" in |
66 | then | 69 | 'Isolated Web Content' | 'Web Content' | 'Isolated Web Co') |
67 | set -- "$@" "$pid" | 70 | set -- "$@" "$pid" |
68 | fi | 71 | debugLOG "accept /proc/$pid/comm $comm" |
72 | ;; | ||
73 | *) | ||
74 | debugLOG "reject /proc/$pid/comm $comm" | ||
75 | esac | ||
69 | done | 76 | done |
70 | 77 | ||
71 | # echo "pids: ($*|$(echo $procs))" >&2 | 78 | # echo "pids: ($*|$(echo $procs))" >&2 |
@@ -73,8 +80,12 @@ do | |||
73 | then | 80 | then |
74 | slay_slayer | 81 | slay_slayer |
75 | wait $ioslay | 82 | wait $ioslay |
76 | ioslay-firefox "$@" & | 83 | if [ $# -gt 0 ] |
77 | ioslay=$! | 84 | then |
85 | ioslay-firefox "$@" & | ||
86 | ioslay=$! | ||
87 | noticeLOG "Launched ioslay-firefox[$ioslay] $*" | ||
88 | fi | ||
78 | fi | 89 | fi |
79 | lastargs=$* | 90 | lastargs=$* |
80 | fi | 91 | fi |