summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2022-08-06 13:23:16 -0400
committerAndrew Cady <d@jerkface.net>2022-08-06 13:23:16 -0400
commitb61532af6a86d81d1633a4de144fccbb64f9e604 (patch)
tree6bb788a061c2fb70ae408d7d4afa763ea8f8782f
parenta900e57cbc4a010eb570bb84fe9146f21999b3a9 (diff)
don't use 'fireslay' anymore; get pids list in ioslay-mgr.sh and pass them to ioslay-firefox to kill there
-rwxr-xr-xioslay-firefox12
-rwxr-xr-xioslay-mgr.sh25
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
80if [ $# -le 0 ]
81then
82 exit
83fi
84
85pids=$*
86
77sudo_iotop -qq -b $(printf '\55\55pid=%s\n' "$@") | iotop_reader 87sudo_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
6fi 6fi
7 7
8export NOTICE=y
9noticeLOG() { [ "$NOTICE" ] || return; echo "Notice: $*" >&2; }
10debugLOG() { [ "$DBG" ] || return; echo "Debug: $*" >&2; }
11
8. sliceweasel.lib.sh 12. sliceweasel.lib.sh
9 13
10vkill() 14vkill()
@@ -38,7 +42,6 @@ GROUP_BASENAME=firefox
38 42
39group_procs=$(get_firefox_cgroup_procs) 43group_procs=$(get_firefox_cgroup_procs)
40 44
41wantcomm='Web Content'
42ioslay= 45ioslay=
43lastprocs= 46lastprocs=
44SIGNALLED= 47SIGNALLED=
@@ -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