[syslog-ng]MYSQL pipe 2

Steven S syslog-ng@lists.balabit.hu
Thu, 6 Jan 2005 09:34:56 -0500


What does,
    ps=`ps -ax | grep "\--password=x" | awk '{ print $9 }'`
do and how do you know it is not running?

-Steve S.

> -----Original Message-----
> From: syslog-ng-admin@lists.balabit.hu [mailto:syslog-ng-
> admin@lists.balabit.hu] On Behalf Of
> Robert.COward@deploymenthealth.osd.mil
> Sent: Wednesday, January 05, 2005 9:15 AM
> To: syslog-ng@lists.balabit.hu
> Cc: ssurdock@engineered-net.com
> Subject: RE: [syslog-ng]MYSQL pipe 2
> 
> 
> 
> 
> 
> 
> Steven,
> 
> Thanks for the quick response. here is what my mysql entry looks like in
> /etc/rc.local:
> 
> # MYSQL
> if [ X"${mysql}" == X"YES" ]; then
>         if [ -x /usr/local/bin/mysqld_safe ]; then
>                 echo -n " mysql";       /usr/local/bin/mysqld_safe
> --socket=/var/www/var/run/mysql/mysql.sock &
>                 sleep 10
>                 echo -n " syslog-ng2mysql";
> /etc/check_syslog-ng2mysql.sh &
>         fi
> fi
> 
> and here is the /etc/check_syslog-ng2mysql.sh script i sent in yesterday:
> 
> #!/bin/sh
> ps=`ps -ax | grep "\--password=x" | awk '{ print $9 }'`
> 
> if [[ $ps != "" ]]; then
>         echo "syslog-ng2mysql is alive."
> else
>         if [ ! -p /tmp/mysql.pipe ]; then
>                 mkfifo /tmp/mysql.pipe
>                 kill -HUP `cat /var/run/syslog-ng.pid`
>         fi
>         mysql -u root --password=password syslog < /tmp/mysql.pipe
> fi
> 
> I don't think the problem is that mysqld is not started when i issue the
> mysql command in the script. I think it has something to do with how
> openbsd starts daemons
> from within /etc/rc.local and /etc/rc. When i reboot this server, the
> /etc/check_syslog-ng2mysql.sh does nto start at all.
> Basically I am just looking for other ways to start
> /etc/check_syslog-ng2mysql.sh or more to the point the "mysql -u root
> --password=password syslog < /tmp/mysql.pipe" line
> which just dumps the data from a named pipe created by syslog-ng, over to
> the mysql db. Thanks for all the help.
>