-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathflushcache.sh
executable file
·37 lines (33 loc) · 1.07 KB
/
flushcache.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
#
# This script is called to remove storage data that are cached by OS while loading the graph
#
# Having a sudo access to the machine with a Linux distribution,
# the /drop_caches.sh file can be created by running the following three steps
# sudo echo -e '#!/bin/bash\n\necho 3 > /proc/sys/vm/drop_caches\n' > /drop_caches.sh
# sudo chmod a+x /drop_caches.sh
# sudo echo -e 'ALL ALL = (ALL) NOPASSWD: /drop_caches.sh\n' >> /etc/sudoers
#
# [1] https://www.kernel.org/doc/Documentation/sysctl/vm.txt
#
# If you have created a similar script, you may add its path as a new line to the COMMS variable
#
# If none of the script exist, `flushcache` file in `paragrapher/test` is called
# which may take a longer time to finish
COMMS=`echo -e "
/drop_caches.sh
/var/shared/power/bin/flushcache.sh
/opt/service/bin/dropcache both
"`
while IFS= read -r c; do
c=`echo "$c" | xargs`
[ -z "$c" ] && continue
file=`echo "$c"|cut -f1 -d' '`
if [ -f $file ]; then
$c
[ $? = 0 ] && exit
sudo -n $c
[ $? = 0 ] && exit
fi
done <<< $COMMS
make flushcache -C paragrapher/test