summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@cryptonomic.net>2021-10-19 07:44:42 -0400
committerAndrew Cady <d@cryptonomic.net>2021-10-19 07:44:42 -0400
commit01144e666dd1b3daed500ab230fbc7d0266962da (patch)
tree77af1166d631458c3f073e4cf3c66add9bf862d2
parentcdca287a2d0b9941acafe1629ef1d1ee4285e95b (diff)
add command fireslay
-rw-r--r--Makefile2
-rwxr-xr-xfireslay38
2 files changed, 39 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 77aabe8..3d6a476 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
1BINDIR = /usr/local/bin 1BINDIR = /usr/local/bin
2BINARIES = sliceweasel 2BINARIES = sliceweasel fireslay
3SUDO != [ "$$(id -u)" = 0 ] || echo sudo 3SUDO != [ "$$(id -u)" = 0 ] || echo sudo
4 4
5.PHONY: install install-bin 5.PHONY: install install-bin
diff --git a/fireslay b/fireslay
new file mode 100755
index 0000000..1826561
--- /dev/null
+++ b/fireslay
@@ -0,0 +1,38 @@
1#!/bin/sh
2set -e
3d=$(mktemp -d)
4trap "cd /; rm -r '$d'" EXIT
5cd "$d"
6
7web_content_pids()
8{
9 top -w512 -bn1 -o '%MEM' | sed -e '1,/^$/d' | {
10 while read line
11 do set -- $line
12 [ "${12} ${13}" = "Web Content" ] || continue
13 echo $1
14 done
15 }
16}
17
18lesser_tabs()
19{
20 web_content_pids > pids
21 if [ $(wc -l < pids) -gt 1 ]
22 then
23 sed 1d < pids | tac
24 fi
25}
26
27FIRST=y
28for tab in $(lesser_tabs)
29do
30 if [ "$FIRST" ]
31 then
32 FIRST=
33 ps $tab
34 (set -x
35 kill "$tab")
36 fi
37 ps $tab
38done