From owner-freebsd-questions Fri Apr 7 21:50:46 2000 Delivered-To: freebsd-questions@freebsd.org Received: from mail.alpha.net.au (mail2.alpha.net.au [203.41.44.8]) by hub.freebsd.org (Postfix) with ESMTP id 5692837BD19 for ; Fri, 7 Apr 2000 21:50:26 -0700 (PDT) (envelope-from dannyh@idx.com.au) Received: from freebsd.freebsd.org (surry-pool-160.alpha.net.au [203.41.44.160] (may be forged)) by mail.alpha.net.au (8.9.3/8.9.3) with SMTP id OAA20603; Sat, 8 Apr 2000 14:48:43 +1000 From: Danny To: "Thomas M. Sommers" , antti@mysql.com Subject: Re: mysqld exits immediately Date: Sun, 9 Apr 2000 14:51:43 +1000 X-Mailer: KMail [version 1.0.21] Content-Type: text/plain Cc: freebsd-questions@FreeBSD.ORG References: <38ED6A3F.EEE0B01D@mail.ptd.net> MIME-Version: 1.0 Message-Id: <00040914530502.00323@freebsd.freebsd.org> Content-Transfer-Encoding: 8bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Try creating one like mine which is soemthing like mine to see what happens #!/bin/sh # if [ -x /usr/local/bin/safe_mysqld ] then /usr/local/bin/safe_mysqld & && echo -n ' mysql' fi On Fri, 07 Apr 2000, Thomas M. Sommers wrote: > Antti S Halonen wrote: > > > > Thomas M. Sommers writes: > > > When started at boot time, mysql exits immediately. There are no error > > > messages or log entries. This used to happen occasionally, but now > > > happens every time. When started manually (using safe_mysqld), however, > > > there has been no problem. Does anyone have any ideas about why this is > > > happening? > > > > What have you done exactly? Are you using the mysql.server script? > > > > I just installed the package without any modifications. It installs a > shell script in /usr/local/etc/rc.d, which in turn runs safe_mysqld. > > I should have mentioned that I use FreeBSD 3.2-RELEASE, and mysql > 3.22.22, > > Here are my files. The comment starting with '###' is where the problem > occurs. > > ----- /usr/local/etc/rc.d/mysql.sh ----- > #!/bin/sh > # > /sbin/ldconfig -m /usr/local/lib/mysql > if [ -x /usr/local/bin/safe_mysqld ] > then > /usr/local/bin/safe_mysqld > /dev/null & && echo -n ' mysql' > fi > > ----- /usr/local/bin/safe_mysqld ----- > #!/bin/sh > # Copyright Abandoned 1996 TCX DataKonsult AB & Monty Program KB & Detron HB > # This file is public domain and comes with NO WARRANTY of any kind > # > # scripts to start the MySQL daemon and restart it if it dies unexpectedly > # > # This should be executed in the MySQL base directory if you are using a > # binary installation that has other paths than you are using. > # > # mysql.server works by first doing a cd to the base directory and from there > # executing safe_mysqld > > trap '' 1 2 3 15 # we shouldn't let anyone kill us > > MY_BASEDIR_VERSION=/usr/local > DATADIR=/var/db/mysql > ledir=/usr/local/libexec > > pid_file=$DATADIR/`/bin/hostname`.pid > log=$DATADIR/`/bin/hostname`.log > err_log=$DATADIR/`/bin/hostname`.err > > # Parse arguments to see if caller wants the pid_file somewhere else. > for arg > do > case $arg > in > --pid-file=*) > pid_file=`echo "$arg" | sed -e "s;--pid-file=;;"` > ;; > esac > done > > # > # If there exists an old pid file, check if the daemon is already running > # Note: The switches to 'ps' may depend on your operating system > > if test -f $pid_file > then > PID=`cat $pid_file` > if /bin/kill -0 $PID > then > if /bin/ps -uaxww | grep mysqld | grep " $PID " > /dev/null > then # The pid contains a mysqld process > echo "A mysqld process already exists" > echo "A mysqld process already exists at " `date` >> $err_log > exit 1; > fi > fi > rm -f $pid_file > if test -f $pid_file > then > echo "Fatal error: Can't remove the pid file: $pid_file" > echo "Fatal error: Can't remove the pid file: $pid_file at " `date` >> $err_log > echo "Please remove it manually and start $0 again" > echo "mysqld daemon not started" > exit 1; > fi > fi > > echo "Starting mysqld daemon with databases from $DATADIR" > > #Default communication ports > #MYSQL_TCP_PORT=3306 > if test -z "$MYSQL_UNIX_PORT" > then > MYSQL_UNIX_PORT="/tmp/mysql.sock" > export MYSQL_UNIX_PORT > fi > #export MYSQL_TCP_PORT > > # Does this work on all systems? > #if type ulimit | grep "shell builtin" > /dev/null > #then > # ulimit -n 256 > /dev/null 2>&1 # Fix for BSD and FreeBSD systems > #fi > > echo "mysqld started on " `date` >> $err_log > while true > do > rm -f $MYSQL_UNIX_PORT $pid_file # Some extra safety > if test "$#" -eq 0 > then > ### This is the line that executes mysqld, which exits immediately. > nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR \ > >> $err_log 2>&1 > else > nohup $ledir/mysqld --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR \ > "$@" >> $err_log 2>&1 > fi > if test ! -f $pid_file # This is removed if normal shutdown > then > break; > fi > echo "mysqld restarted on " `date` | tee -a $err_log > done > > echo "mysqld ended on " `date` >> $err_log > echo "mysqld daemon ended" > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-questions" in the body of the message -- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message