summary refs log tree commit diff
path: root/src/runsv.check
blob: edfd0c9207857823b53504346bcb121e59d919dd (plain) (blame)
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
#!/bin/sh
rm -rf "${ctmp}"

runsv
echo $?

mkdir "${ctmp}"
echo '#!/bin/sh' >"${ctmp}"/run
echo 'echo starting' >>"${ctmp}"/run
echo 'exec sleep 14' >>"${ctmp}"/run
chmod 700 "${ctmp}"/run
runsv "${ctmp}" &
sleep 1
test -r "${ctmp}"/supervise/stat || sleep 2
cat "${ctmp}"/supervise/stat
mkdir -p "${ctmp}"/control
echo '#!/bin/sh' >"${ctmp}"/control/t
echo 'echo term' >>"${ctmp}"/control/t
echo 'exit 1' >>"${ctmp}"/control/t
chmod 700 "${ctmp}"/control/t
echo t >"${ctmp}"/supervise/control
sleep 2
echo x >"${ctmp}"/supervise/control
wait
echo $?

mkdir "${ctmp}"/log
echo '#!/bin/sh' >"${ctmp}"/log/run
echo 'exec cat >foo' >>"${ctmp}"/log/run
chmod 700 "${ctmp}"/log/run
runsv "${ctmp}" &
sleep 1
test -r "${ctmp}"/log/supervise/stat || sleep 2
mkdir -p "${ctmp}"/control
echo '#!/bin/sh' >"${ctmp}"/control/i
echo 'echo no interrupt' >>"${ctmp}"/control/i
echo 'exit 0' >>"${ctmp}"/control/i
chmod 700 "${ctmp}"/control/i
echo i >"${ctmp}"/supervise/control
sleep 1
echo x >"${ctmp}"/supervise/control
wait
echo $?
cat "${ctmp}"/log/foo

rm -rf "${ctmp}"/supervise
rm -rf "${ctmp}"/log/supervise
rm -f "${ctmp}"/log/foo
ln -s foo "${ctmp}"/supervise
ln -s bar "${ctmp}"/log/supervise
runsv "${ctmp}" &
sleep 1
test -r "${ctmp}"/supervise/stat || sleep 2
test -r "${ctmp}"/log/supervise/stat || sleep 2
echo x >"${ctmp}"/foo/control
wait
echo $?
cat "${ctmp}"/log/foo
rm -rf "${ctmp}"