summaryrefslogtreecommitdiff
path: root/firestart.redux
diff options
context:
space:
mode:
Diffstat (limited to 'firestart.redux')
-rwxr-xr-xfirestart.redux57
1 files changed, 0 insertions, 57 deletions
diff --git a/firestart.redux b/firestart.redux
deleted file mode 100755
index 59d8f8a..0000000
--- a/firestart.redux
+++ /dev/null
@@ -1,57 +0,0 @@
1#!/bin/bash
2
3die() { printf "%s: Error: %s\n" "$0" "$*" >&2; exit 1; }
4
5# Test DEVICE WRITE OPS BY WRITEOPS
6test_write_ops()
7{
8 if ! [ -e "$1" ]
9 then
10 mkdir -p "$(dirname "$1")"
11 sync
12 begin=$(date +%s%N)
13 dd if=/dev/urandom of="$DIR"/urandom.out bs=1M count=300
14 sync
15 end=$(date +%s%N)
16 ops=$(( (end - begin) / 1000000000 ))
17 rm "$DIR"/urandom.out
18 echo "$ops" > "$1"
19 fi
20 cat "$1"
21}
22
23CMD=firefox
24UNIT=$CMD
25DIR=~/.mozilla
26READ_OPS=1G
27WRITE_OPS=$READ_OPS
28CONFDIR=$HOME/.config/firestart
29
30if [ -e "$CONFDIR"/conf ]
31then
32 . "$CONFDIR"/conf
33fi
34
35WRITE_OPS=$(test_write_ops "$CONFDIR"/diskspeed.dat)
36WRITE_OPS=${WRITE_OPS%.*}
37READ_OPS=$WRITE_OPS
38
39[ -e "$DIR" ] || die "does not exist: $DIR"
40[ -d "$DIR" ] || die "not a directory: $DIR"
41
42DEV=$(echo $(findmnt --target "$DIR" -o MAJ:MIN -n))
43[ "$DEV" ] || die "could not determine backing device for $DIR"
44
45IOReadIOPSMax="$DEV $READ_OPS"
46IOWriteIOPSMax="$DEV $WRITE_OPS"
47
48sed -e "s/^IOReadIOPSMax *=.*/IOReadIOPSMax = $IOReadIOPSMax/" \
49 -e "s/^IOWriteIOPSMax *=.*/IOWriteIOPSMax = $IOWriteIOPSMax/" \
50 < firefox@.service.in > firefox@.service
51
52set -x
53
54systemctl --user link "$PWD"/firefox@.service
55systemctl --user link "$PWD"/ioslay@.service
56systemctl --user daemon-reload
57systemctl --user start "firefox@$DISPLAY"