File: watch

package info (click to toggle)
sbd 1.5.2-6~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 804 kB
  • sloc: ansic: 5,303; sh: 654; makefile: 119
file content (51 lines) | stat: -rwxr-xr-x 845 bytes parent folder | download | duplicates (5)
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
#!/bin/sh

set -e

DISK=$AUTOPKGTEST_TMP/disk
NODE=autopkgtest

cleanup () {
  [ "$LOOP" ] && losetup -d $LOOP
}

trap "cleanup" 0 2 3 15

# create test disk
echo "=== losetup ==="
dd if=/dev/zero of=$DISK bs=1M count=10 2>&1
LOOP=$(losetup --find --show $DISK)

echo "=== create ==="
sbd -n $NODE -d $LOOP create

echo "=== allocate ==="
sbd -n $NODE -d $LOOP allocate $NODE

echo "=== list ==="
sbd -n $NODE -d $LOOP list

echo "=== dump ==="
sbd -n $NODE -d $LOOP dump

echo "=== watch ==="
mkdir -p /var/lib/pacemaker/cores
sbd -n $NODE -d $LOOP -W -W watch
pgrep -a sbd

echo "=== test ==="
sbd -n $NODE -d $LOOP message $NODE test

echo "=== exit ==="
sbd -n $NODE -d $LOOP message $NODE exit

# wait for exit
for i in 1 2 3 4 5; do
  pgrep sbd >/dev/null || break
  sleep 1
done

if pgrep -a sbd; then
  echo sbd did not exit
  exit 1
fi