diff options
author | Andrew Cady <d@cryptonomic.net> | 2022-04-03 15:53:28 -0400 |
---|---|---|
committer | Andrew Cady <d@cryptonomic.net> | 2022-04-03 15:53:51 -0400 |
commit | 7c17d07ac3c9213565345c6cf75cced5b592c318 (patch) | |
tree | 6ff91de5bdf5f920346a4dcbdff1ce3705315657 | |
parent | f611896935bc6ad9979eb9052c99af8225cced19 (diff) |
new firefox launcher: firestart
-rw-r--r-- | Makefile | 2 | ||||
-rwxr-xr-x | firestart | 30 |
2 files changed, 31 insertions, 1 deletions
@@ -1,5 +1,5 @@ | |||
1 | BINDIR = /usr/local/bin | 1 | BINDIR = /usr/local/bin |
2 | BINARIES = sliceweasel sliceweasel.lib.sh sliceuser fireslay ioslay-firefox cgroup-show-each-new-process ioslay-mgr.sh | 2 | BINARIES = sliceweasel sliceweasel.lib.sh sliceuser fireslay ioslay-firefox cgroup-show-each-new-process ioslay-mgr.sh firestart |
3 | SUDO != [ "$$(id -u)" = 0 ] || echo sudo | 3 | SUDO != [ "$$(id -u)" = 0 ] || echo sudo |
4 | 4 | ||
5 | .PHONY: install install-bin | 5 | .PHONY: install install-bin |
diff --git a/firestart b/firestart new file mode 100755 index 0000000..5be6d02 --- /dev/null +++ b/firestart | |||
@@ -0,0 +1,30 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | CMD=firefox | ||
4 | UNIT=$CMD | ||
5 | DIR=~/.mozilla | ||
6 | MEMORY_MAX=50% | ||
7 | READ_OPS=1G | ||
8 | WRITE_OPS=$READ_OPS | ||
9 | |||
10 | if systemctl --user is-active "$UNIT" >/dev/null | ||
11 | then | ||
12 | exec "$CMD" "$@" | ||
13 | exit | ||
14 | fi | ||
15 | |||
16 | DEV=$(echo $(findmnt --target "$DIR" -o MAJ:MIN -n)) | ||
17 | [ "$DEV" ] || exit | ||
18 | |||
19 | systemctl --user reset-failed "$UNIT" 2>/dev/null | ||
20 | systemd-run --user \ | ||
21 | --unit="$UNIT" \ | ||
22 | --setenv=DISPLAY="$DISPLAY" \ | ||
23 | --setenv=XAUTHORITY="$XAUTHORITY" \ | ||
24 | --property=MemoryMax="$MEMORY_MAX" \ | ||
25 | --property=IOReadIOPSMax="$DEV $READ_OPS" \ | ||
26 | --property=IOWriteIOPSMax="$DEV $WRITE_OPS" \ | ||
27 | --property=IOWriteIOPSMax="$DEV $WRITE_OPS" \ | ||
28 | --property=Restart="on-failure" \ | ||
29 | -- \ | ||
30 | "$CMD" "$@" | ||