Why is there a /etc/init.d/mysql file on this Slackware machine? How could it have gotten there?

Posted by jasonspiro on Server Fault See other posts from Server Fault or by jasonspiro
Published on 2012-07-06T02:31:43Z Indexed on 2012/07/06 3:17 UTC
Read the original article Hit count: 1474

Filed under:
|
|

A client of my IT-consulting service owns a web-development shop. He's been having problems with a Slackware 12.0 server running MySQL 5.0.67. The machine was set up by the client's sysadmin, who left on bad terms. My client no longer employs a sysadmin.

As far as I can tell, the only copy of MySQL that's installed is the one described in /var/log/packages/mysql-5.0.67-i486-1:

PACKAGE NAME:     mysql-5.0.67-i486-1
COMPRESSED PACKAGE SIZE:     16828 K
UNCOMPRESSED PACKAGE SIZE:     33840 K
PACKAGE LOCATION: /var/slapt-get/archives/./slackware/ap/mysql-5.0.67-i486-1.tgz
PACKAGE DESCRIPTION:
mysql: mysql (SQL-based relational database server)
mysql:
mysql: MySQL is a fast, multi-threaded, multi-user, and robust SQL
mysql: (Structured Query Language) database server.  It comes with a nice API
mysql: which makes it easy to integrate into other applications.
mysql:
mysql: The home page for MySQL is http://www.mysql.com/
mysql:
mysql:
mysql:
mysql:
FILE LIST:
./
var/
var/lib/
var/lib/mysql/
var/run/
var/run/mysql/
install/
install/doinst.sh
install/slack-desc
usr/
usr/include/
usr/include/mysql/
usr/include/mysql/my_alloc.h
usr/include/mysql/sql_common.h
usr/include/mysql/my_dbug.h
usr/include/mysql/errmsg.h
usr/include/mysql/my_pthread.h
usr/include/mysql/my_list.h
usr/include/mysql/mysql.h
usr/include/mysql/sslopt-vars.h
usr/include/mysql/my_config.h
usr/include/mysql/mysql_com.h
usr/include/mysql/m_string.h
usr/include/mysql/sslopt-case.h
usr/include/mysql/my_xml.h
usr/include/mysql/sql_state.h
usr/include/mysql/my_global.h
usr/include/mysql/my_sys.h
usr/include/mysql/mysqld_ername.h
usr/include/mysql/mysqld_error.h
usr/include/mysql/sslopt-longopts.h
usr/include/mysql/keycache.h
usr/include/mysql/my_net.h
usr/include/mysql/mysql_version.h
usr/include/mysql/my_no_pthread.h
usr/include/mysql/decimal.h
usr/include/mysql/readline.h
usr/include/mysql/my_attribute.h
usr/include/mysql/typelib.h
usr/include/mysql/my_dir.h
usr/include/mysql/raid.h
usr/include/mysql/m_ctype.h
usr/include/mysql/mysql_embed.h
usr/include/mysql/mysql_time.h
usr/include/mysql/my_getopt.h
usr/lib/
usr/lib/mysql/
usr/lib/mysql/libmysqlclient_r.so.15.0.0
usr/lib/mysql/libmysqlclient_r.la
usr/lib/mysql/libmyisammrg.a
usr/lib/mysql/libmystrings.a
usr/lib/mysql/libmyisam.a
usr/lib/mysql/libmysqlclient.so.15.0.0
usr/lib/mysql/libmysqlclient_r.a
usr/lib/mysql/libmysqlclient.a
usr/lib/mysql/libheap.a
usr/lib/mysql/libvio.a
usr/lib/mysql/libmysqlclient.la
usr/lib/mysql/libmysys.a
usr/lib/mysql/libdbug.a
usr/bin/
usr/bin/comp_err
usr/bin/my_print_defaults
usr/bin/resolve_stack_dump
usr/bin/msql2mysql
usr/bin/mysqltestmanager-pwgen
usr/bin/myisampack
usr/bin/replace
usr/bin/mysqld_multi
usr/bin/mysqlaccess
usr/bin/mysql_install_db
usr/bin/innochecksum
usr/bin/myisam_ftdump
usr/bin/mysqlcheck
usr/bin/mysqltest
usr/bin/mysql_upgrade_shell
usr/bin/mysql_secure_installation
usr/bin/mysql_fix_extensions
usr/bin/mysqld_safe
usr/bin/mysql_explain_log
usr/bin/mysqlimport
usr/bin/myisamlog
usr/bin/mysql_tzinfo_to_sql
usr/bin/mysql_upgrade
usr/bin/mysqltestmanager
usr/bin/mysql_fix_privilege_tables
usr/bin/mysql_find_rows
usr/bin/mysql_convert_table_format
usr/bin/mysqltestmanagerc
usr/bin/mysqlhotcopy
usr/bin/mysqldump
usr/bin/mysqlshow
usr/bin/mysqlbug
usr/bin/mysql_config
usr/bin/mysqldumpslow
usr/bin/mysql_waitpid
usr/bin/mysqlbinlog
usr/bin/mysql_client_test
usr/bin/perror
usr/bin/mysql
usr/bin/myisamchk
usr/bin/mysql_setpermission
usr/bin/mysqladmin
usr/bin/mysql_zap
usr/bin/mysql_tableinfo
usr/bin/resolveip
usr/share/
usr/share/mysql/
usr/share/mysql/errmsg.txt
usr/share/mysql/swedish/
usr/share/mysql/swedish/errmsg.sys
usr/share/mysql/mysql_system_tables_data.sql
usr/share/mysql/mysql.server
usr/share/mysql/hungarian/
usr/share/mysql/hungarian/errmsg.sys
usr/share/mysql/norwegian/
usr/share/mysql/norwegian/errmsg.sys
usr/share/mysql/slovak/
usr/share/mysql/slovak/errmsg.sys
usr/share/mysql/spanish/
usr/share/mysql/spanish/errmsg.sys
usr/share/mysql/polish/
usr/share/mysql/polish/errmsg.sys
usr/share/mysql/ukrainian/
usr/share/mysql/ukrainian/errmsg.sys
usr/share/mysql/danish/
usr/share/mysql/danish/errmsg.sys
usr/share/mysql/romanian/
usr/share/mysql/romanian/errmsg.sys
usr/share/mysql/english/
usr/share/mysql/english/errmsg.sys
usr/share/mysql/charsets/
usr/share/mysql/charsets/latin2.xml
usr/share/mysql/charsets/greek.xml
usr/share/mysql/charsets/koi8r.xml
usr/share/mysql/charsets/latin1.xml
usr/share/mysql/charsets/cp866.xml
usr/share/mysql/charsets/geostd8.xml
usr/share/mysql/charsets/cp1250.xml
usr/share/mysql/charsets/koi8u.xml
usr/share/mysql/charsets/cp852.xml
usr/share/mysql/charsets/hebrew.xml
usr/share/mysql/charsets/latin7.xml
usr/share/mysql/charsets/README
usr/share/mysql/charsets/ascii.xml
usr/share/mysql/charsets/cp1251.xml
usr/share/mysql/charsets/macce.xml
usr/share/mysql/charsets/latin5.xml
usr/share/mysql/charsets/Index.xml
usr/share/mysql/charsets/macroman.xml
usr/share/mysql/charsets/cp1256.xml
usr/share/mysql/charsets/keybcs2.xml
usr/share/mysql/charsets/swe7.xml
usr/share/mysql/charsets/armscii8.xml
usr/share/mysql/charsets/dec8.xml
usr/share/mysql/charsets/cp1257.xml
usr/share/mysql/charsets/hp8.xml
usr/share/mysql/charsets/cp850.xml
usr/share/mysql/korean/
usr/share/mysql/korean/errmsg.sys
usr/share/mysql/german/
usr/share/mysql/german/errmsg.sys
usr/share/mysql/mi_test_all.res
usr/share/mysql/greek/
usr/share/mysql/greek/errmsg.sys
usr/share/mysql/french/
usr/share/mysql/french/errmsg.sys
usr/share/mysql/mysql_fix_privilege_tables.sql
usr/share/mysql/dutch/
usr/share/mysql/dutch/errmsg.sys
usr/share/mysql/serbian/
usr/share/mysql/serbian/errmsg.sys
usr/share/mysql/mysql_system_tables.sql
usr/share/mysql/my-huge.cnf
usr/share/mysql/portuguese/
usr/share/mysql/portuguese/errmsg.sys
usr/share/mysql/japanese/
usr/share/mysql/japanese/errmsg.sys
usr/share/mysql/mysql_test_data_timezone.sql
usr/share/mysql/russian/
usr/share/mysql/russian/errmsg.sys
usr/share/mysql/czech/
usr/share/mysql/czech/errmsg.sys
usr/share/mysql/fill_help_tables.sql
usr/share/mysql/estonian/
usr/share/mysql/estonian/errmsg.sys
usr/share/mysql/my-medium.cnf
usr/share/mysql/norwegian-ny/
usr/share/mysql/norwegian-ny/errmsg.sys
usr/share/mysql/my-small.cnf
usr/share/mysql/mysql-log-rotate
usr/share/mysql/italian/
usr/share/mysql/italian/errmsg.sys
usr/share/mysql/my-large.cnf
usr/share/mysql/ndb-config-2-node.ini
usr/share/mysql/binary-configure
usr/share/mysql/mi_test_all
usr/share/mysql/mysqld_multi.server
usr/share/mysql/my-innodb-heavy-4G.cnf
usr/doc/
usr/doc/mysql-5.0.67/
usr/doc/mysql-5.0.67/README
usr/doc/mysql-5.0.67/Docs/
usr/doc/mysql-5.0.67/Docs/INSTALL-BINARY
usr/doc/mysql-5.0.67/COPYING
usr/info/
usr/info/mysql.info.gz
usr/libexec/
usr/libexec/mysqld
usr/libexec/mysqlmanager
usr/man/
usr/man/man8/
usr/man/man8/mysqlmanager.8.gz
usr/man/man8/mysqld.8.gz
usr/man/man1/
usr/man/man1/mysql_zap.1.gz
usr/man/man1/mysql_setpermission.1.gz
usr/man/man1/mysql_tzinfo_to_sql.1.gz
usr/man/man1/msql2mysql.1.gz
usr/man/man1/mysql_tableinfo.1.gz
usr/man/man1/mysql_explain_log.1.gz
usr/man/man1/mysqlcheck.1.gz
usr/man/man1/comp_err.1.gz
usr/man/man1/my_print_defaults.1.gz
usr/man/man1/mysqlbinlog.1.gz
usr/man/man1/myisam_ftdump.1.gz
usr/man/man1/mysql_upgrade.1.gz
usr/man/man1/mysql.1.gz
usr/man/man1/mysql_client_test.1.gz
usr/man/man1/resolve_stack_dump.1.gz
usr/man/man1/mysql_fix_extensions.1.gz
usr/man/man1/mysqlmanagerc.1.gz
usr/man/man1/mysql_config.1.gz
usr/man/man1/mysqlshow.1.gz
usr/man/man1/myisamlog.1.gz
usr/man/man1/replace.1.gz
usr/man/man1/mysqlmanager-pwgen.1.gz
usr/man/man1/mysqltest.1.gz
usr/man/man1/innochecksum.1.gz
usr/man/man1/mysqladmin.1.gz
usr/man/man1/perror.1.gz
usr/man/man1/mysql_waitpid.1.gz
usr/man/man1/mysql_convert_table_format.1.gz
usr/man/man1/mysqlman.1.gz
usr/man/man1/mysqlimport.1.gz
usr/man/man1/mysqlbug.1.gz
usr/man/man1/mysql_find_rows.1.gz
usr/man/man1/myisampack.1.gz
usr/man/man1/myisamchk.1.gz
usr/man/man1/mysql_fix_privilege_tables.1.gz
usr/man/man1/mysql-stress-test.pl.1.gz
usr/man/man1/resolveip.1.gz
usr/man/man1/make_win_bin_dist.1.gz
usr/man/man1/mysqlhotcopy.1.gz
usr/man/man1/mysqld_multi.1.gz
usr/man/man1/safe_mysqld.1.gz
usr/man/man1/mysql_secure_installation.1.gz
usr/man/man1/mysql_install_db.1.gz
usr/man/man1/mysqldump.1.gz
usr/man/man1/mysql-test-run.pl.1.gz
usr/man/man1/mysqld_safe.1.gz
usr/man/man1/mysqlaccess.1.gz
usr/man/man1/mysql.server.1.gz
usr/man/man1/make_win_src_distribution.1.gz
etc/
etc/rc.d/
etc/rc.d/rc.mysqld.new
etc/my-huge.cnf
etc/my-medium.cnf
etc/my-small.cnf
etc/my-large.cnf

/etc/rc.d/rc.mysqld is an ordinary Slackware-type start/stop script:

#!/bin/sh
# Start/stop/restart mysqld.
#
# Copyright 2003 Patrick J. Volkerding, Concord, CA
# Copyright 2003 Slackware Linux, Inc., Concord, CA
#
# This program comes with NO WARRANTY, to the extent permitted by law.
# You may redistribute copies of this program under the  terms of the
# GNU General Public License.

# To start MySQL automatically at boot, be sure this script is executable:
# chmod 755 /etc/rc.d/rc.mysqld

# Before you can run MySQL, you must have a database.  To install an initial
# database, do this as root:
#
#   su - mysql
#   mysql_install_db
#
# Note that step one is becoming the mysql user.  It's important to do this
# before making any changes to the database, or mysqld won't be able to write
# to it later (this can be fixed with 'chown -R mysql.mysql /var/lib/mysql').

# To allow outside connections to the database comment out the next line.
# If you don't need incoming network connections, then leave the line
# uncommented to improve system security.
#SKIP="--skip-networking"

# Start mysqld:
mysqld_start() {
  if [ -x /usr/bin/mysqld_safe ]; then
    # If there is an old PID file (no mysqld running), clean it up:
    if [ -r /var/run/mysql/mysql.pid ]; then
      if ! ps axc | grep mysqld 1> /dev/null 2> /dev/null ; then
        echo "Cleaning up old /var/run/mysql/mysql.pid."
        rm -f /var/run/mysql/mysql.pid
      fi
    fi
    /usr/bin/mysqld_safe --datadir=/var/lib/mysql --pid-file=/var/run/mysql/mysql.pid $SKIP &
  fi
}

# Stop mysqld:
mysqld_stop() {
  # If there is no PID file, ignore this request...
  if [ -r /var/run/mysql/mysql.pid ]; then
    killall mysqld
    # Wait at least one minute for it to exit, as we don't know how big the DB is...
    for second in 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 \
      0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 60 ; do
      if [ ! -r /var/run/mysql/mysql.pid ]; then
        break;
      fi
      sleep 1
    done
    if [ "$second" = "60" ]; then
      echo "WARNING:  Gave up waiting for mysqld to exit!"
      sleep 15
    fi
  fi
}

# Restart mysqld:
mysqld_restart() {
  mysqld_stop
  mysqld_start
}

case "$1" in
'start')
  mysqld_start
  ;;
'stop')
  mysqld_stop
  ;;
'restart')
  mysqld_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac

But there's also an unexpected init script on the machine, named /etc/init.d/mysql:

#!/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

# MySQL daemon start/stop script.

# Usually this is put in /etc/init.d (at least on machines SYSV R4 based
# systems) and linked to /etc/rc3.d/S99mysql and /etc/rc0.d/K01mysql.
# When this is done the mysql server will be started when the machine is
# started and shut down when the systems goes down.

# Comments to support chkconfig on RedHat Linux
# chkconfig: 2345 64 36
# description: A very fast and reliable SQL database engine.

# Comments to support LSB init script conventions
### BEGIN INIT INFO
# Provides: mysql
# Required-Start: $local_fs $network $remote_fs
# Should-Start: ypbind nscd ldap ntpd xntpd
# Required-Stop: $local_fs $network $remote_fs
# Default-Start:  2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: start and stop MySQL
# Description: MySQL is a very fast and reliable SQL database engine.
### END INIT INFO

# If you install MySQL on some other places than /usr, then you
# have to do one of the following things for this script to work:
#
# - Run this script from within the MySQL installation directory
# - Create a /etc/my.cnf file with the following information:
#   [mysqld]
#   basedir=<path-to-mysql-installation-directory>
# - Add the above to any other configuration file (for example ~/.my.ini)
#   and copy my_print_defaults to /usr/bin
# - Add the path to the mysql-installation-directory to the basedir variable
#   below.
#
# If you want to affect other MySQL variables, you should make your changes
# in the /etc/my.cnf, ~/.my.cnf or other MySQL configuration files.

# If you change base dir, you must also change datadir. These may get
# overwritten by settings in the MySQL configuration files.

#basedir=
#datadir=

# Default value, in seconds, afterwhich the script should timeout waiting
# for server start. 
# Value here is overriden by value in my.cnf. 
# 0 means don't wait at all
# Negative numbers mean to wait indefinitely
service_startup_timeout=900

# The following variables are only set for letting mysql.server find things.

# Set some defaults
pid_file=/var/run/mysql/mysql.pid
server_pid_file=/var/run/mysql/mysql.pid
use_mysqld_safe=1
user=mysql
if test -z "$basedir"
then
  basedir=/usr
  bindir=/usr/bin
  if test -z "$datadir"
  then
    datadir=/var/lib/mysql
  fi
  sbindir=/usr/sbin
  libexecdir=/usr/libexec
else
  bindir="$basedir/bin"
  if test -z "$datadir"
  then
    datadir="$basedir/data"
  fi
  sbindir="$basedir/sbin"
  libexecdir="$basedir/libexec"
fi

# datadir_set is used to determine if datadir was set (and so should be
# *not* set inside of the --basedir= handler.)
datadir_set=

#
# Use LSB init script functions for printing messages, if possible
#
lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions ; then
  . $lsb_functions
else
  log_success_msg()
  {
    echo " SUCCESS! $@"
  }
  log_failure_msg()
  {
    echo " ERROR! $@"
  }
fi

PATH=/sbin:/usr/sbin:/bin:/usr/bin:$basedir/bin
export PATH

mode=$1    # start or stop
shift
other_args="$*"   # uncommon, but needed when called from an RPM upgrade action
           # Expected: "--skip-networking --skip-grant-tables"
           # They are not checked here, intentionally, as it is the resposibility
           # of the "spec" file author to give correct arguments only.

case `echo "testing\c"`,`echo -n testing` in
    *c*,-n*) echo_n=   echo_c=     ;;
    *c*,*)   echo_n=-n echo_c=     ;;
    *)       echo_n=   echo_c='\c' ;;
esac

parse_server_arguments() {
  for arg do
    case "$arg" in
      --basedir=*)  basedir=`echo "$arg" | sed -e 's/^[^=]*=//'`
                    bindir="$basedir/bin"
            if test -z "$datadir_set"; then
              datadir="$basedir/data"
            fi
            sbindir="$basedir/sbin"
            libexecdir="$basedir/libexec"
        ;;
      --datadir=*)  datadir=`echo "$arg" | sed -e 's/^[^=]*=//'`
            datadir_set=1
    ;;
      --user=*)  user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
      --pid-file=*) server_pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
      --service-startup-timeout=*) service_startup_timeout=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
      --use-mysqld_safe) use_mysqld_safe=1;;
      --use-manager)     use_mysqld_safe=0;;
    esac
  done
}

parse_manager_arguments() {
  for arg do
    case "$arg" in
      --pid-file=*) pid_file=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
      --user=*)  user=`echo "$arg" | sed -e 's/^[^=]*=//'` ;;
    esac
  done
}

wait_for_pid () {
  verb="$1"
  manager_pid="$2"  # process ID of the program operating on the pid-file
  i=0
  avoid_race_condition="by checking again"
  while test $i -ne $service_startup_timeout ; do

    case "$verb" in
      'created')
        # wait for a PID-file to pop into existence.
        test -s $pid_file && i='' && break
        ;;
      'removed')
        # wait for this PID-file to disappear
        test ! -s $pid_file && i='' && break
        ;;
      *)
        echo "wait_for_pid () usage: wait_for_pid created|removed manager_pid"
        exit 1
        ;;
    esac

    # if manager isn't running, then pid-file will never be updated
    if test -n "$manager_pid"; then
      if kill -0 "$manager_pid" 2>/dev/null; then
        :  # the manager still runs
      else
        # The manager may have exited between the last pid-file check and now.  
        if test -n "$avoid_race_condition"; then
          avoid_race_condition=""
          continue  # Check again.
        fi

        # there's nothing that will affect the file.
        log_failure_msg "Manager of pid-file quit without updating file."
        return 1  # not waiting any more.
      fi
    fi

    echo $echo_n ".$echo_c"
    i=`expr $i + 1`
    sleep 1
  done

  if test -z "$i" ; then
    log_success_msg
    return 0
  else
    log_failure_msg
    return 1
  fi
}

# Get arguments from the my.cnf file,
# the only group, which is read from now on is [mysqld]
if test -x ./bin/my_print_defaults
then
  print_defaults="./bin/my_print_defaults"
elif test -x $bindir/my_print_defaults
then
  print_defaults="$bindir/my_print_defaults"
elif test -x $bindir/mysql_print_defaults
then
  print_defaults="$bindir/mysql_print_defaults"
else
  # Try to find basedir in /etc/my.cnf
  conf=/etc/my.cnf
  print_defaults=
  if test -r $conf
  then
    subpat='^[^=]*basedir[^=]*=\(.*\)$'
    dirs=`sed -e "/$subpat/!d" -e 's//\1/' $conf`
    for d in $dirs
    do
      d=`echo $d | sed -e 's/[  ]//g'`
      if test -x "$d/bin/my_print_defaults"
      then
        print_defaults="$d/bin/my_print_defaults"
        break
      fi
      if test -x "$d/bin/mysql_print_defaults"
      then
        print_defaults="$d/bin/mysql_print_defaults"
        break
      fi
    done
  fi

  # Hope it's in the PATH ... but I doubt it
  test -z "$print_defaults" && print_defaults="my_print_defaults"
fi

#
# Read defaults file from 'basedir'.   If there is no defaults file there
# check if it's in the old (depricated) place (datadir) and read it from there
#

extra_args=""
if test -r "$basedir/my.cnf"
then
  extra_args="-e $basedir/my.cnf"
else
  if test -r "$datadir/my.cnf"
  then
    extra_args="-e $datadir/my.cnf"
  fi
fi

parse_server_arguments `$print_defaults $extra_args mysqld server mysql_server mysql.server`

# Look for the pidfile 
parse_manager_arguments `$print_defaults $extra_args manager`

#
# Set pid file if not given
#
if test -z "$pid_file"
then
  pid_file=$datadir/mysqlmanager-`/bin/hostname`.pid
else
  case "$pid_file" in
    /* ) ;;
    * )  pid_file="$datadir/$pid_file" ;;
  esac
fi
if test -z "$server_pid_file"
then
  server_pid_file=$datadir/`/bin/hostname`.pid
else
  case "$server_pid_file" in
    /* ) ;;
    * )  server_pid_file="$datadir/$server_pid_file" ;;
  esac
fi

case "$mode" in
  'start')
    # Start daemon

    # Safeguard (relative paths, core dumps..)
    cd $basedir

    manager=$bindir/mysqlmanager
    if test -x $libexecdir/mysqlmanager
    then
      manager=$libexecdir/mysqlmanager
    elif test -x $sbindir/mysqlmanager
    then
      manager=$sbindir/mysqlmanager
    fi

    echo $echo_n "Starting MySQL"
    if test -x $manager -a "$use_mysqld_safe" = "0"
    then
      if test -n "$other_args"
      then
        log_failure_msg "MySQL manager does not support options '$other_args'"
        exit 1
      fi
      # Give extra arguments to mysqld with the my.cnf file. This script may
      # be overwritten at next upgrade.
      $manager --user=$user --pid-file=$pid_file >/dev/null 2>&1 &
      wait_for_pid created $!; return_value=$?

      # Make lock for RedHat / SuSE
      if test -w /var/lock/subsys
      then
        touch /var/lock/subsys/mysqlmanager
      fi
      exit $return_value
    elif test -x $bindir/mysqld_safe
    then
      # Give extra arguments to mysqld with the my.cnf file. This script
      # may be overwritten at next upgrade.
      pid_file=$server_pid_file
      $bindir/mysqld_safe --datadir=$datadir --pid-file=$server_pid_file $other_args >/dev/null 2>&1 &
      wait_for_pid created $!; return_value=$?

      # Make lock for RedHat / SuSE
      if test -w /var/lock/subsys
      then
        touch /var/lock/subsys/mysql
      fi
      exit $return_value
    else
      log_failure_msg "Couldn't find MySQL manager ($manager) or server ($bindir/mysqld_safe)"
    fi
    ;;

  'stop')
    # Stop daemon. We use a signal here to avoid having to know the
    # root password.

    # The RedHat / SuSE lock directory to remove
    lock_dir=/var/lock/subsys/mysqlmanager

    # If the manager pid_file doesn't exist, try the server's
    if test ! -s "$pid_file"
    then
      pid_file=$server_pid_file
      lock_dir=/var/lock/subsys/mysql
    fi

    if test -s "$pid_file"
    then
      mysqlmanager_pid=`cat $pid_file`
      echo $echo_n "Shutting down MySQL"
      kill $mysqlmanager_pid
      # mysqlmanager should remove the pid_file when it exits, so wait for it.
      wait_for_pid removed "$mysqlmanager_pid"; return_value=$?

      # delete lock for RedHat / SuSE
      if test -f $lock_dir
      then
        rm -f $lock_dir
      fi
      exit $return_value
    else
      log_failure_msg "MySQL manager or server PID file could not be found!"
    fi
    ;;

  'restart')
    # Stop the service and regardless of whether it was
    # running or not, start it again.
    if $0 stop  $other_args; then
      $0 start $other_args
    else
      log_failure_msg "Failed to stop running server, so refusing to try to start."
      exit 1
    fi
    ;;

  'reload'|'force-reload')
    if test -s "$server_pid_file" ; then
      read mysqld_pid <  $server_pid_file
      kill -HUP $mysqld_pid && log_success_msg "Reloading service MySQL"
      touch $server_pid_file
    else
      log_failure_msg "MySQL PID file could not be found!"
      exit 1
    fi
    ;;
  'status')
    # First, check to see if pid file exists
    if test -s "$server_pid_file" ; then 
      read mysqld_pid < $server_pid_file
      if kill -0 $mysqld_pid 2>/dev/null ; then 
        log_success_msg "MySQL running ($mysqld_pid)"
        exit 0
      else
        log_failure_msg "MySQL is not running, but PID file exists"
        exit 1
      fi
    else
      # Try to find appropriate mysqld process
      mysqld_pid=`pidof $sbindir/mysqld`
      if test -z $mysqld_pid ; then 
        if test "$use_mysqld_safe" = "0" ; then 
          lockfile=/var/lock/subsys/mysqlmanager
        else
          lockfile=/var/lock/subsys/mysql
        fi 
        if test -f $lockfile ; then 
          log_failure_msg "MySQL is not running, but lock exists"
          exit 2
        fi 
        log_failure_msg "MySQL is not running"
        exit 3
      else
        log_failure_msg "MySQL is running but PID file could not be found"
        exit 4
      fi
    fi
    ;;
    *)
      # usage
      echo "Usage: $0  {start|stop|restart|reload|force-reload|status}  [ MySQL server options ]"
      exit 1
    ;;
esac

exit 0

An unimportant aside: The previous users of the machine kept a messy home directory. Their home directory was /root. I've pasted a copy at http://www.pastebin.ca/2167496.

My question:

Why is there a /etc/init.d/mysql file on this Slackware machine? How could it have gotten there?

P.S. This question is far from perfect. Please feel free to edit it.

© Server Fault or respective owner

Related posts about mysql

Related posts about init.d