diff options
Diffstat (limited to 'src/fireslay')
-rwxr-xr-x | src/fireslay | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/fireslay b/src/fireslay new file mode 100755 index 0000000..3c68ad5 --- /dev/null +++ b/src/fireslay | |||
@@ -0,0 +1,38 @@ | |||
1 | #!/bin/sh | ||
2 | set -e | ||
3 | . sliceweasel.lib.sh | ||
4 | |||
5 | is_web_content() | ||
6 | { | ||
7 | local comm state | ||
8 | read comm < /proc/"$1"/comm && [ "$comm" = 'Web Content' ] && | ||
9 | read _ _ state _ < /proc/"$1"/stat && [ "$state" != Z ] || return | ||
10 | } | ||
11 | |||
12 | web_content_pids() | ||
13 | { | ||
14 | while read pid | ||
15 | do | ||
16 | if is_web_content $pid | ||
17 | then | ||
18 | echo $pid | ||
19 | fi | ||
20 | done < $FIREFOX_GROUP_PROCS | ||
21 | } | ||
22 | |||
23 | FIREFOX_GROUP_PROCS=$(get_firefox_cgroup_procs) | ||
24 | |||
25 | [ -e "$FIREFOX_GROUP_PROCS" ] || die "Firefox group not found ($FIREFOX_GROUP_PROCS)" | ||
26 | |||
27 | set -- $(web_content_pids) | ||
28 | |||
29 | if [ $# = 0 ] | ||
30 | then | ||
31 | exit | ||
32 | fi | ||
33 | |||
34 | ( | ||
35 | set -x | ||
36 | ps $* >&2 | ||
37 | kill $* | ||
38 | ) | ||