-
Notifications
You must be signed in to change notification settings - Fork 249
/
Copy pathcache.sh
63 lines (54 loc) · 1.16 KB
/
cache.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
RSNODE="172.16.1.21 172.16.1.22 172.16.1.31 172.16.1.52 172.16.1.53"
function cache_count(){
for host in $RSNODE
do
echo -n "${host}: "
ssh root@${host} "ls /www/zoshow/product/ |wc -l"
done
}
function cache_delete(){
for host in $RSNODE
do
ssh root@${host} "find /www/zoshow/product/ -name '*.html' -type f -print | xargs rm -rf"
echo "${host}: OK"
done
}
function quiet(){
if [ $1 = "delete" ]; then
cache_delete >/dev/null 2>&1
else
usage
fi
}
function usage(){
echo $"Usage: $0 [OPTION] {count|delete}"
echo $"
Options
-v, --verbose increase verbosity
-q, --quiet suppress non-error messages
-h, --help show this help (-h works with no other options)
"
}
#cache_count
#cache_delete
#cache_count
case "$1" in
count)
cache_count
;;
delete)
cache_delete
;;
-q)
quiet $2
;;
"--quiet")
quiet $2
;;
*)
usage
RETVAL=2
;;
esac
exit $RETVAL