repo.or.cz
/
hband-tools.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
add proper error handling for all final exec calls
[hband-tools.git]
/
root-tools
/
swapoff-progress
blob
0770babae75278cf7524160e77cfff732d57fc8d
1
#!/bin/bash
2
3
set -u
4
5
swapdevice
=
$1
6
7
swapon
-s
|
grep
-qw
"
$swapdevice
"
&&
swapoff
"
$swapdevice
"
&
8
pid
=
$
!
9
while
[
-d
/
proc
/
$pid
];
do
10
swapon
-s
|
grep
-w
^
"
$swapdevice
"
11
sleep
1
12
done
| \
13
awk
'{printf "
\r
\e
[K%.2f%%",
$4
*100/
$3
}'
14
echo
15
16
if
[
"
${swapdevice:0:9}
"
= /
dev
/
zram
];
then
17
modprobe
-i -r
zram
18
fi
19