equal
deleted
inserted
replaced
1 #!/bin/sh |
1 #!/bin/sh |
2 |
2 |
3 VERIFY_ALG='sha1' |
3 DEFAULTS_FILE=/etc/default/verify-drbd |
4 RESOURCES='all' |
4 [ -e $DEFAULTS_FILE ] && . $DEFAULTS_FILE |
5 |
5 |
6 usage() { |
6 usage() { |
7 cat <<__U |
7 cat <<__U |
8 usage: |
8 usage: |
9 $0 [-v verify-alg] [res ..[res]] |
9 $0 [-o] [res ..[res]] |
|
10 $0 -? |
|
11 |
|
12 you may override disk and/or net options for verification in $DEFAULTS_FILE |
|
13 |
10 __U |
14 __U |
11 |
15 |
12 } |
16 } |
13 |
17 |
14 while getopts "v:" opt; do |
18 while getopts "h" opt; do |
15 case $opt in |
19 case $opt in |
16 v) |
20 h) |
17 VERIFY_ALG="$OPTARG" |
21 usage |
|
22 exit 0 |
18 ;; |
23 ;; |
19 \?) |
24 \?) |
20 usage |
25 usage |
21 exit 1 |
26 exit 1 |
22 ;; |
27 ;; |
27 if [ "$#" != '0' ]; then |
32 if [ "$#" != '0' ]; then |
28 RESOURCES="$@" |
33 RESOURCES="$@" |
29 fi |
34 fi |
30 |
35 |
31 for r in $RESOURCES; do |
36 for r in $RESOURCES; do |
32 drbdadm -- --c-plan-ahead 1 --c-fill-target 64k disk-options $r |
37 [ -n "$DISK_OPTIONS" ] && drbdadm -- $DISK_OPTIONS disk-options $r |
33 drbdadm -- --verify-alg $VERIFY_ALG net-options $r |
38 [ -n "$NET_OPTIONS" ] && drbdadm -- $NET_OPTIONS net-options $r |
34 drbdadm verify $r |
39 [ "$OPTIONS_ONLY" = 'y' ] || drbdadm verify $r |
35 done |
40 done |
36 |
41 |
37 for r in $RESOURCES; do |
42 for r in $RESOURCES; do |
38 while drbdadm cstate $r | grep '^Verify' >/dev/null; do sleep 60; done |
43 while drbdadm cstate $r | grep '^Verify' >/dev/null; do sleep 60; done |
39 drbdadm adjust $r |
44 drbdadm adjust $r |