Fixed a problem with mysqld_multi log file. The default is now datadir/mysqld_multi.log,

if doesn't exists or is not writable, then /var/log/mysqld_multi.log, if does not exists
or is not writable, then /tmp/mysqld_multi.log, but only in case the file does not yet
exists in /tmp. Otherwise log will be disabled, unless user explicitely sets it with an
option.
parent 83f6f4a0
......@@ -52,6 +52,7 @@ hf@genie.(none)
igor@hundin.mysql.fi
igor@rurik.mysql.com
ingo@mysql.com
jani@a80-186-24-72.elisa-laajakaista.fi
jani@dsl-jkl1657.dial.inet.fi
jani@dsl-kpogw4gb5.dial.inet.fi
jani@hynda.(none)
......
......@@ -4,12 +4,12 @@ use Getopt::Long;
use POSIX qw(strftime);
$|=1;
$VER="2.5";
$VER="2.6";
$opt_config_file = undef();
$opt_example = 0;
$opt_help = 0;
$opt_log = "/tmp/mysqld_multi.log";
$opt_log = "";
$opt_mysqladmin = "@bindir@/mysqladmin";
$opt_mysqld = "@libexecdir@/mysqld";
$opt_no_log = 0;
......@@ -18,6 +18,9 @@ $opt_tcp_ip = 0;
$opt_user = "root";
$opt_version = 0;
my $my_print_defaults_exists= 1;
my $logdir= undef();
my ($mysqld, $mysqladmin, $groupids, $homedir, $my_progname);
$homedir = $ENV{HOME};
......@@ -42,7 +45,9 @@ sub main
print "Please make sure you have this command available and\n";
print "in your path. The command is available from the latest\n";
print "MySQL distribution.\n";
$my_print_defaults_exists= 0;
}
init_log();
my @defops = `my_print_defaults mysqld_multi`;
chop @defops;
splice @ARGV, 0, 0, @defops;
......@@ -112,6 +117,56 @@ sub main
}
}
####
#### Init log file. Check for appropriate place for log file, in the following
#### order my_print_defaults mysqld datadir, @datadir@, /var/log, /tmp
####
sub init_log
{
if ($my_print_defaults_exists)
{
@mysqld_opts= `my_print_defaults mysqld`;
chomp @mysqld_opts;
foreach my $opt (@mysqld_opts)
{
if ($opt =~ m/^\-\-datadir[=](.*)/)
{
if (-d "$1" && -w "$1")
{
$logdir= $1;
}
}
}
}
if (!defined($logdir))
{
$logdir= "@datadir@" if (-d "@datadir@" && -w "@datadir@");
}
if (!defined($logdir))
{
$logdir= "/var/log" if (-d "/var/log" && -w "/var/log");
}
if (!defined($logdir))
{
if (-d "/tmp" && -w "/tmp" && ! -e "/tmp/mysqld_multi.log")
{
$logdir= "/tmp";
}
}
if (!defined($logdir))
{
# We still couldn't get a default log file in place. Log file
# will be disabled unless user sets it with an option
$opt_no_log= 1;
}
else
{
$opt_log= "$logdir/mysqld_multi.log";
}
}
####
#### Report living and not running MySQL servers
####
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment