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
|
#!/bin/sh -e
rm -f /tmp/input
rm -f /tmp/output.log
echo "Starting syslog-ng"
/usr/sbin/syslog-ng --no-caps --process-mode=background --cfgfile /$(pwd)/debian/tests/config.syslog --persist-file=/tmp/persist_file --pidfile=/tmp/syslog-ng.pid --control=/tmp/syslog-ng.control
sleep 2
PID=$(cat /tmp/syslog-ng.pid)
echo "Syslog-ng pid is $PID"
if [ ! -L /proc/$PID/exe ]
then
echo "syslog-ng could not start"
exit 1
fi
echo "Sending a log message"
logger -u /tmp/input almafa
sleep 1
kill $PID
grep -q almafa /tmp/output.log
if [ $? -eq 1 ]
then
echo "Logged message could not found"
exit 1
fi
echo "Sent message has been found in the log. Good"
|