diff options
Diffstat (limited to 'firestart.redux')
-rwxr-xr-x | firestart.redux | 57 |
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 | |||
3 | die() { printf "%s: Error: %s\n" "$0" "$*" >&2; exit 1; } | ||
4 | |||
5 | # Test DEVICE WRITE OPS BY WRITEOPS | ||
6 | test_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 | |||
23 | CMD=firefox | ||
24 | UNIT=$CMD | ||
25 | DIR=~/.mozilla | ||
26 | READ_OPS=1G | ||
27 | WRITE_OPS=$READ_OPS | ||
28 | CONFDIR=$HOME/.config/firestart | ||
29 | |||
30 | if [ -e "$CONFDIR"/conf ] | ||
31 | then | ||
32 | . "$CONFDIR"/conf | ||
33 | fi | ||
34 | |||
35 | WRITE_OPS=$(test_write_ops "$CONFDIR"/diskspeed.dat) | ||
36 | WRITE_OPS=${WRITE_OPS%.*} | ||
37 | READ_OPS=$WRITE_OPS | ||
38 | |||
39 | [ -e "$DIR" ] || die "does not exist: $DIR" | ||
40 | [ -d "$DIR" ] || die "not a directory: $DIR" | ||
41 | |||
42 | DEV=$(echo $(findmnt --target "$DIR" -o MAJ:MIN -n)) | ||
43 | [ "$DEV" ] || die "could not determine backing device for $DIR" | ||
44 | |||
45 | IOReadIOPSMax="$DEV $READ_OPS" | ||
46 | IOWriteIOPSMax="$DEV $WRITE_OPS" | ||
47 | |||
48 | sed -e "s/^IOReadIOPSMax *=.*/IOReadIOPSMax = $IOReadIOPSMax/" \ | ||
49 | -e "s/^IOWriteIOPSMax *=.*/IOWriteIOPSMax = $IOWriteIOPSMax/" \ | ||
50 | < firefox@.service.in > firefox@.service | ||
51 | |||
52 | set -x | ||
53 | |||
54 | systemctl --user link "$PWD"/firefox@.service | ||
55 | systemctl --user link "$PWD"/ioslay@.service | ||
56 | systemctl --user daemon-reload | ||
57 | systemctl --user start "firefox@$DISPLAY" | ||