blob: fa1565c5c017c4c1753e24382221e10726e1b21a (
plain)
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
|
#!/bin/bash
outfile=$RSYSLOG_OUT_LOG
echo "Starting" >> $outfile
echo "<= OK" >> $outfile
echo "OK"
just_started=true
read line
while [[ -n "$line" ]]; do
message=${line//$'\n'}
echo "=> $message" >> $outfile
if [[ $message == *02* ]]; then
# Test partial reads from pipe
echo "<= OK" >> $outfile
printf 'O'
printf 'K'
printf '\n'
elif [[ $message == *04* ]]; then
if [[ $just_started == false ]]; then
# Force a restart due to 'confirmTimeout' (2 seconds) exceeded
echo "<= (timeout)" >> $outfile
./msleep 10000
else
# When the message is retried (just after restart), confirm it correctly
echo "<= OK" >> $outfile
echo "OK"
fi
elif [[ $message == *07* ]]; then
# Test keep-alive feature for long-running processing (more than 2 seconds)
echo "<= ........OK" >> $outfile
for i in {1..8}; do
./msleep 500
printf '.'
done
printf 'OK\n'
else
echo "<= OK" >> $outfile
echo "OK"
fi
just_started=false
read line
done
exit 0
|