#!/bin/bash i=$RANDOM /etc/rc.d/syslog-ng stop if [ -e /dev/log ]; then echo "warning: some daemon has left a /dev/log, removing..." rm /dev/log fi if [ -x ./minilogd ]; then echo "starting ./minilogd:" ./minilogd else echo "starting minilog found in PATH" minilogd fi r=$? if [ $r -eq 0 ]; then echo "minilog started normally" else echo "minilogd exit code: $r" fi sleep 3 pid=$(pgrep minilogd) r=$? if [ $r -eq 0 ]; then echo "minilogd process is pid: $pid" else echo "cannot find minilogd in process list" fi str="minilogd-test: $i" echo "sending a test log message: $str" logger -p err "$str" echo "logger exit code: $?" sleep 3 echo "starting syslog:" /etc/rc.d/syslog-ng start sleep 3 echo "searching /var/log/ for: $str" grep -- "$str" /var/log/* if [ $? -eq 0 ]; then echo "logged message found" else echo "error: message not found" fi