summaryrefslogtreecommitdiffstats
path: root/tests/testsuites/omprog-feedback-mt-bin.sh
blob: 97cf12fd9a15c14b883b33974d05fd6f880268db (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
#!/bin/bash

outfile=$RSYSLOG_OUT_LOG

status="OK"
echo $status

retried=false

read line
while [[ -n "$line" ]]; do
    message=${line//$'\n'}

    if [[ $((RANDOM % 100)) < $1 ]]; then
        status="Error: could not process log message"
        retried=true
    else
        if [[ $retried == true ]]; then
            echo "=> $message (retried)" >> $outfile
            retried=false
        else
            echo "=> $message" >> $outfile
        fi
        status="OK"
    fi

    echo $status
    read line
done

exit 0