summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@cryptonomic.net>2022-04-03 15:53:28 -0400
committerAndrew Cady <d@cryptonomic.net>2022-04-03 15:53:51 -0400
commit7c17d07ac3c9213565345c6cf75cced5b592c318 (patch)
tree6ff91de5bdf5f920346a4dcbdff1ce3705315657
parentf611896935bc6ad9979eb9052c99af8225cced19 (diff)
new firefox launcher: firestart
-rw-r--r--Makefile2
-rwxr-xr-xfirestart30
2 files changed, 31 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index d67b257..7cb92ae 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,5 @@
1BINDIR = /usr/local/bin 1BINDIR = /usr/local/bin
2BINARIES = sliceweasel sliceweasel.lib.sh sliceuser fireslay ioslay-firefox cgroup-show-each-new-process ioslay-mgr.sh 2BINARIES = sliceweasel sliceweasel.lib.sh sliceuser fireslay ioslay-firefox cgroup-show-each-new-process ioslay-mgr.sh firestart
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/firestart b/firestart
new file mode 100755
index 0000000..5be6d02
--- /dev/null
+++ b/firestart
@@ -0,0 +1,30 @@
1#!/bin/sh
2
3CMD=firefox
4UNIT=$CMD
5DIR=~/.mozilla
6MEMORY_MAX=50%
7READ_OPS=1G
8WRITE_OPS=$READ_OPS
9
10if systemctl --user is-active "$UNIT" >/dev/null
11then
12 exec "$CMD" "$@"
13 exit
14fi
15
16DEV=$(echo $(findmnt --target "$DIR" -o MAJ:MIN -n))
17[ "$DEV" ] || exit
18
19systemctl --user reset-failed "$UNIT" 2>/dev/null
20systemd-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" "$@"