Hi,<br>
i m using a script which logs certain alerts to mysql db. It mostly
wotks fine but sometimes i see that i m not getting the alerts into
mysql db i have to then manually start the service. I m using the
following code for the above mentioned purpose which is being taken
from <a href="http://www.vermeer.org/display_doc.php?doc_id=1#scripts">http://www.vermeer.org/display_doc.php?doc_id=1#scripts</a>. I m
getting the logs in flat files but none in the mysql db.<br>
<br>
Thanks<br>
<br>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">
#!/bin/bash<br>
#<br>
# sqlsyslogd This is a daemon that takes syslog-ng input and pipe it into<br>
# a MySQL database.<br>
#<br>
# chkconfig: 2345 92 10<br>
# description: sqlsyslogd bridges syslog-ng and mysql.<br>
# author: Josh Kuo Thu 2004/08/12 13:21:56 PDT<br>
<br>
. /etc/rc.d/init.d/functions<br>
<br>
case "$1" in<br>
        start)<br>
                if [ -x /tmp/mysql.pipe ]; then<br>
                        mkfifo /tmp/mysql.pipe<br>
                else<br>
                        # if the service is already running, do not start another one<br>
                        PIDS=`pidofproc mysql`<br>
                        if [ "$PIDS" ]; then<br>
                                gprintf "sqlsyslogd is already running.\n"<br>
                                exit 1<br>
                        fi<br>
                        mysql -u DBUSERNAME --password=PASSWORD DBNAME < /tmp/mysql.pipe &<br>
                fi<br>
                ;<br>
        stop )<br>
                killproc mysql<br>
                ;<br>
<br>
        *)<br>
                gprintf "Usage: sqlsyslogd {start|stop}\n"<br>
                exit 1;<br>
esac<br>
exit 0;</font><br>