[syslog-ng]MYSQL pipe 3

syslog-ng@lists.balabit.hu syslog-ng@lists.balabit.hu
Tue, 18 Jan 2005 09:35:01 -0500





Anyway i fixed the problem and also found out why its was happening:

(from my post at www.screamingelectron.org)

                                                                            
                                                                            
   I think you are not allowed to start things in /etc/rc, and redirect     
   cause the default starts as nobody. heres what I put in to get this      
   thing going:                                                             
                                                                            
   su - root -c "/etc/check_syslog-ng2mysql.sh" &                           
                                                                            
   I know not the most secure method, but its a start.                      
                                                                            
   so I put the following in my /etc/rc.local file :                        
   # 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";     su - root -c             
   "/etc/check_syslog-ng2mysql.sh" &                                        
           fi                                                               
   fi                                                                       
                                                                            
                                                                            



where /etc/check_syslog-ng2mysql.sh is:

                                                                            
                                                                            
   #!/usr/local/bin/bash -x                                                 
                                                                            
   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                                                                       
                                                                            
                                                                            




You can find the thread here:

http://www.screamingelectron.org/forum/showthread.php?t=2029

Thanks for all your help.

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

>-Steve S.

Just a sloppy way for checking for the mysql client connection.



---
18 January 2005
"Christianity has operated with an unmitigated arrogance and cruelty --
necessarily, since a religion ordinarily imposes on those who have
discovered the true faith the spiritual duty of liberating the infidels."
(James A. Baldwin, (1924-1987)
---
Robert V. Coward
UNIX System Administrator
Computer Science Corporation