summaryrefslogtreecommitdiffstats
path: root/tests/testsuites/omprog-close-unresponsive-bin.sh
blob: 9f3664477d2f9b5c87decdffc95ecf092c7fb9f0 (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
#!/bin/bash

outfile=$RSYSLOG_OUT_LOG

function handle_sigterm {
    echo "Received SIGTERM" >> $outfile
}
trap "handle_sigterm" SIGTERM

echo "Starting" >> $outfile

# Tell rsyslog we are ready to start processing messages
echo "OK"

read log_line
while [[ -n "$log_line" ]]; do
    echo "Received $log_line" >> $outfile

    # Tell rsyslog we are ready to process the next message
    echo "OK"

    read log_line
done

echo "Terminating unresponsively" >> $outfile

# Terminate with a very long sleep, so omprog will kill this process when
# the closeTimeout (which we have configured to a short value) is reached.
# (Note hat the sleep subprocess itself will not be killed.)
sleep 150s

exit 0