Installation guide

94 Chapter 5:Database Services
else
if test -d "$datadir"
then
pid_file=$datadir/‘hostname‘.pid
fi
fi
if grep "^basedir" $conf > /dev/null
then
basedir=‘grep "^basedir" $conf | cut -f 2 -d= | tr -d ’ ’‘
bindir=$basedir/bin
fi
if grep "^bindir" $conf > /dev/null
then
bindir=‘grep "^bindir" $conf | cut -f 2 -d=| tr -d ’ ’‘
fi
fi
# Safeguard (relative paths, core dumps..)
cd $basedir
case "$mode" in
’start’)
# Start daemon
if test -x $bindir/safe_mysqld
then
# Give extra arguments to mysqld with the my.cnf file. This script may
# be overwritten at next upgrade.
$bindir/safe_mysqld –user=$mysql_daemon_user –pid-file=$pid_file –datadir=$datadir &
else
echo "Can’t execute $bindir/safe_mysqld"
fi
;;
’stop’)
# Stop daemon. We use a signal here to avoid having to know the
# root password.
if test -f "$pid_file"
then
mysqld_pid=‘cat $pid_file‘
echo "Killing mysqld with pid $mysqld_pid"
kill $mysqld_pid
# mysqld should remove the pid_file when it exits.
else