summaryrefslogtreecommitdiff
path: root/firestart
diff options
context:
space:
mode:
Diffstat (limited to 'firestart')
-rwxr-xr-xfirestart30
1 files changed, 30 insertions, 0 deletions
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" "$@"