Re: daemontools and mysqld

"Gary C. New" <[email protected]> Fri, 22 Sep 2006 13:02:29 -0700 (PDT)
Newsgroups gmane.comp.djb.syslog
Message-ID <[email protected]>
Here's the hacked mysqld run script I put together for
daemontools.  It insures that no mysqld processes are
running before starting mysqld up.

Hope this helps.

Respectfully,


Gary


#!/bin/sh
#
# run
#
# chmod 755 /etc/mysqld/run
# ln -s /etc/mysqld /service/mysqld
#
# description: Safeguards the proper start/shutdown of
mysqld under daemontools
#
# Gary C. New ([email protected])
                                                      
                                                      
              
# Location of mysqld binary
mysqld_path="/usr/local/mysql/bin/mysqld"
                                                      
                                                      
              
# Location of mysqld pid file
mysqld_pid_file="/var/run/localhost.pid"
                                                      
                                                      
              
# Check for running mysqld pids
mysqld_pids=`ps ax | grep -E "${mysqld_path}" | grep
-v grep | awk '{print $1}'`
                                                      
                                                      
              
# If mysqld pids still exist, send SIGTERM
# to proper mysqld pid before restarting
if [ -n "$mysqld_pids" ]; then
   #echo $mysqld_pids
   kill -SIGTERM `cat $mysqld_pid_file`
fi
                                                      
                                                      
              
# Start mysqld with options
exec 2>&1
exec /usr/bin/envuidgid mysql
/usr/local/mysql/bin/mysqld
--defaults-extra-file=/usr/local/mysql/data/my.cnf
--basedir=/usr/local/mysql
--datadir=/usr/local/mysql/data/ --user=mysql
--pid-file=/var/run/localhost.pid --skip-locking


--- Mariano Absatz <[email protected]> wrote:

> On 9/7/06, Cees De Groot <[email protected]> wrote:
> > If there's no command line option, take a peek at
> >
>
http://www.openafs.org/pipermail/openafs-info/2002-February/003409.html
> > - it helped me in taming various daemons with
> daemontools :-)
> Well... it seems mysqld doesn't allow you to run in
> the foreground :-(
> 
> According to
>
http://dev.mysql.com/doc/refman/5.1/en/server-options.html
> there is a --standalone option, but only in windows
> 
> -- 
> Mariano Absatz - El Baby
> el (dot) baby (AT) gmail (dot) com
> el (punto) baby (ARROBA:@) gmail (punto) com
>